mardi 28 septembre 2021

How to write an 'else' condition in python? [closed]

if len(rule_response['Rules']) < 1:
            response = remote_event_client.put_rule(
            Name=eventrulename,
            EventPattern='{"detail-type":["EC2 Instance State-change Notification"],"source":["aws.ec2"],"detail":{"state":["running","terminated"]}}',
            State='ENABLED',
            Description='pdxc mad cloudwatch event rule for '+os.environ['Environment']
            )
            log.debug(response)
            target_response = remote_event_client.put_targets(
                Rule=eventrulename,
                Targets=[
                    {
                        'Arn': sns_response['TopicArn'],
                        'Id': targetname
                    }
                ]
            )
            log.debug(target_response)

These are the hints to write the else condition in python program enter image description here

Aucun commentaire:

Enregistrer un commentaire