def test_execute(self, mock_hook): operator = StackdriverEnableNotificationChannelsOperator( task_id=TEST_TASK_ID, filter_=TEST_FILTER) operator.execute(None) mock_hook.return_value.enable_notification_channels.assert_called_once_with( project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=DEFAULT, metadata=None)
schedule_interval='@once', # Override to match your needs start_date=days_ago(1), tags=['example'], ) as dag: # [START howto_operator_gcp_stackdriver_upsert_notification_channel] create_notification_channel = StackdriverUpsertNotificationChannelOperator( task_id='create-notification-channel', channels=json.dumps({ "channels": [TEST_NOTIFICATION_CHANNEL_1, TEST_NOTIFICATION_CHANNEL_2] }), ) # [END howto_operator_gcp_stackdriver_upsert_notification_channel] # [START howto_operator_gcp_stackdriver_enable_notification_channel] enable_notification_channel = StackdriverEnableNotificationChannelsOperator( task_id='enable-notification-channel', filter_='type="slack"') # [END howto_operator_gcp_stackdriver_enable_notification_channel] # [START howto_operator_gcp_stackdriver_disable_notification_channel] disable_notification_channel = StackdriverDisableNotificationChannelsOperator( task_id='disable-notification-channel', filter_='displayName="channel1"') # [END howto_operator_gcp_stackdriver_disable_notification_channel] # [START howto_operator_gcp_stackdriver_list_notification_channel] list_notification_channel = StackdriverListNotificationChannelsOperator( task_id='list-notification-channel', filter_='type="slack"') # [END howto_operator_gcp_stackdriver_list_notification_channel] # [START howto_operator_gcp_stackdriver_upsert_alert_policy] create_alert_policy = StackdriverUpsertAlertOperator(