Example #1
0
 def test_execute(self, mock_hook):
     operator = StackdriverDeleteNotificationChannelOperator(
         task_id=TEST_TASK_ID,
         name='test-channel',
     )
     operator.execute(None)
     mock_hook.return_value.delete_notification_channel.assert_called_once_with(
         name='test-channel', retry=DEFAULT, timeout=DEFAULT, metadata=None)
Example #2
0
    # [START howto_operator_gcp_stackdriver_disable_alert_policy]
    disable_alert_policy = StackdriverDisableAlertPoliciesOperator(
        task_id='disable-alert-policies',
        filter_='displayName="test alert 1"',
    )
    # [END howto_operator_gcp_stackdriver_disable_alert_policy]

    # [START howto_operator_gcp_stackdriver_list_alert_policy]
    list_alert_policies = StackdriverListAlertPoliciesOperator(
        task_id='list-alert-policies', )
    # [END howto_operator_gcp_stackdriver_list_alert_policy]

    # [START howto_operator_gcp_stackdriver_delete_notification_channel]
    delete_notification_channel = StackdriverDeleteNotificationChannelOperator(
        task_id='delete-notification-channel',
        name=
        "{{ task_instance.xcom_pull('list-notification-channel')[0]['name'] }}",
    )
    # [END howto_operator_gcp_stackdriver_delete_notification_channel]

    delete_notification_channel_2 = StackdriverDeleteNotificationChannelOperator(
        task_id='delete-notification-channel-2',
        name=
        "{{ task_instance.xcom_pull('list-notification-channel')[1]['name'] }}",
    )

    # [START howto_operator_gcp_stackdriver_delete_alert_policy]
    delete_alert_policy = StackdriverDeleteAlertOperator(
        task_id='delete-alert-policy',
        name="{{ task_instance.xcom_pull('list-alert-policies')[0]['name'] }}",
    )
Example #3
0
    # [START howto_operator_gcp_stackdriver_disable_alert_policy]
    disable_alert_policy = StackdriverDisableAlertPoliciesOperator(
        task_id='disable-alert-policies',
        filter_='displayName="test alert 1"',
    )
    # [END howto_operator_gcp_stackdriver_disable_alert_policy]

    # [START howto_operator_gcp_stackdriver_list_alert_policy]
    list_alert_policies = StackdriverListAlertPoliciesOperator(
        task_id='list-alert-policies',
    )
    # [END howto_operator_gcp_stackdriver_list_alert_policy]

    # [START howto_operator_gcp_stackdriver_delete_notification_channel]
    delete_notification_channel = StackdriverDeleteNotificationChannelOperator(
        task_id='delete-notification-channel',
        name='test-channel',
    )
    # [END howto_operator_gcp_stackdriver_delete_notification_channel]

    # [START howto_operator_gcp_stackdriver_delete_alert_policy]
    delete_alert_policy = StackdriverDeleteAlertOperator(
        task_id='delete-alert-polciy',
        name='test-alert',
    )
    # [END howto_operator_gcp_stackdriver_delete_alert_policy]

    create_notification_channel >> enable_notification_channel >> disable_notification_channel
    disable_notification_channel >> list_notification_channel >> create_alert_policy
    create_alert_policy >> enable_alert_policy >> disable_alert_policy >> list_alert_policies
    list_alert_policies >> delete_notification_channel >> delete_alert_policy