How to use describe_alarms method in localstack

Best Python code snippet using localstack_python

aws_cloudwatch_info.py

Source:aws_cloudwatch_info.py Github

copy

Full Screen

...155 AlarmTypes=module.params['alarm_types'],156 StateValue=module.params['alarm_state']157 ), True158 else:159 return client.describe_alarms(160 AlarmNames=module.params['alarm_names'],161 AlarmTypes=module.params['alarm_types'],162 StateValue=module.params['alarm_state']163 ), False164 elif module.params['get_dashboard']:165 return client.get_dashboard(166 DashboardName=module.params['dashboard_name'],167 ), False168 elif module.params['describe_anomaly_detectors']:169 if client.can_paginate('describe_anomaly_detectors'):170 paginator = client.get_paginator('describe_anomaly_detectors')171 return paginator.paginate(172 Namespace=module.params['name_space'],173 MetricName=module.params['metric_name'],...

Full Screen

Full Screen

test_cloudwatch.py

Source:test_cloudwatch.py Github

copy

Full Screen

...28def test_create_alarm():29 conn = boto.connect_cloudwatch()30 alarm = alarm_fixture()31 conn.create_alarm(alarm)32 alarms = conn.describe_alarms()33 alarms.should.have.length_of(1)34 alarm = alarms[0]35 alarm.name.should.equal("tester")36 alarm.namespace.should.equal("tester_namespace")37 alarm.metric.should.equal("tester_metric")38 alarm.comparison.should.equal(">=")39 alarm.threshold.should.equal(2.0)40 alarm.period.should.equal(60)41 alarm.evaluation_periods.should.equal(5)42 alarm.statistic.should.equal("Average")43 alarm.description.should.equal("A test")44 dict(alarm.dimensions).should.equal({"InstanceId": ["i-0123456,i-0123457"]})45 list(alarm.alarm_actions).should.equal(["arn:alarm"])46 list(alarm.ok_actions).should.equal(["arn:ok"])47 list(alarm.insufficient_data_actions).should.equal(["arn:insufficient"])48 alarm.unit.should.equal("Seconds")49 assert "tester" in alarm.alarm_arn50@mock_cloudwatch_deprecated51def test_delete_alarm():52 conn = boto.connect_cloudwatch()53 alarms = conn.describe_alarms()54 alarms.should.have.length_of(0)55 alarm = alarm_fixture()56 conn.create_alarm(alarm)57 alarms = conn.describe_alarms()58 alarms.should.have.length_of(1)59 alarms[0].delete()60 alarms = conn.describe_alarms()61 alarms.should.have.length_of(0)62@mock_cloudwatch_deprecated63def test_put_metric_data():64 conn = boto.connect_cloudwatch()65 conn.put_metric_data(66 namespace="tester",67 name="metric",68 value=1.5,69 dimensions={"InstanceId": ["i-0123456,i-0123457"]},70 )71 metrics = conn.list_metrics()72 metric_names = [m for m in metrics if m.name == "metric"]73 metric_names.should.have(1)74 metric = metrics[0]75 metric.namespace.should.equal("tester")76 metric.name.should.equal("metric")77 dict(metric.dimensions).should.equal({"InstanceId": ["i-0123456,i-0123457"]})78@mock_cloudwatch_deprecated79def test_describe_alarms():80 conn = boto.connect_cloudwatch()81 alarms = conn.describe_alarms()82 alarms.should.have.length_of(0)83 conn.create_alarm(alarm_fixture(name="nfoobar", action="afoobar"))84 conn.create_alarm(alarm_fixture(name="nfoobaz", action="afoobaz"))85 conn.create_alarm(alarm_fixture(name="nbarfoo", action="abarfoo"))86 conn.create_alarm(alarm_fixture(name="nbazfoo", action="abazfoo"))87 enabled = alarm_fixture(name="enabled1", action=["abarfoo"])88 enabled.add_alarm_action("arn:alarm")89 conn.create_alarm(enabled)90 alarms = conn.describe_alarms()91 alarms.should.have.length_of(5)92 alarms = conn.describe_alarms(alarm_name_prefix="nfoo")93 alarms.should.have.length_of(2)94 alarms = conn.describe_alarms(alarm_names=["nfoobar", "nbarfoo", "nbazfoo"])95 alarms.should.have.length_of(3)96 alarms = conn.describe_alarms(action_prefix="afoo")97 alarms.should.have.length_of(2)98 alarms = conn.describe_alarms(alarm_name_prefix="enabled")99 alarms.should.have.length_of(1)100 alarms[0].actions_enabled.should.equal("true")101 for alarm in conn.describe_alarms():102 alarm.delete()103 alarms = conn.describe_alarms()104 alarms.should.have.length_of(0)105@mock_cloudwatch_deprecated106def test_describe_alarms_for_metric():107 conn = boto.connect_cloudwatch()108 conn.create_alarm(alarm_fixture(name="nfoobar", action="afoobar"))109 conn.create_alarm(alarm_fixture(name="nfoobaz", action="afoobaz"))110 conn.create_alarm(alarm_fixture(name="nbarfoo", action="abarfoo"))111 conn.create_alarm(alarm_fixture(name="nbazfoo", action="abazfoo"))112 alarms = conn.describe_alarms_for_metric("nbarfoo_metric", "nbarfoo_namespace")113 alarms.should.have.length_of(1)114 alarms = conn.describe_alarms_for_metric("nbazfoo_metric", "nbazfoo_namespace")115 alarms.should.have.length_of(1)116@mock_cloudwatch_deprecated117def test_get_metric_statistics():...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful