code: def put_trigger(
      source_pipeline_events: List[FeatureProcessorPipelineEvents],
      target_pipeline: str,
      target_pipeline_parameters: Optional[Dict[str, str]] = None,
      state: Optional[str] = DEFAULT_TRIGGER_STATE,
      event_pattern: Optional[str] = None,
      role_arn: Optional[str] = None,
      sagemaker_session: Optional[Session] = None,
  ) -> str:
      """Creates an event based trigger that triggers executions of a sagemaker pipeline.
  
      Args:
          source_pipeline_events (List[FeatureProcessorPipelineEvents]): The list of
              FeatureProcessorPipelineEvents that will trigger the target_pipeline.
          target_pipeline (str): The name of the SageMaker Pipeline that will be triggered.
          target_pipeline_parameters (Optional[Dict[str, str]]): The list of parameters to start
              execution of a pipeline.
          state (Optional[str]):  Indicates whether the rule is enabled or disabled.
              If not specified, it will default to ENABLED.
          event_pattern (Optional[str]): The EventBridge EventPattern that triggers the
              target_pipeline. If specified, will override source_pipeline_events. For more
              information, see
              https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html
              in the Amazon EventBridge User Guide.
          role_arn (Optional[str]): The Amazon Resource Name (ARN) of the IAM role that EventBridge
              Scheduler will assume for this target when the schedule is invoked.
          sagemaker_session (Optional[Session]): Session object which manages interactions
              with Amazon SageMaker APIs and any other AWS services needed. If not specified, the
              function creates one using the default AWS configuration chain.
      Returns:
          str: The EventBridge Rule ARN.
      """
      _sagemaker_session = sagemaker_session or Session()
      _role_arn = role_arn or get_execution_role(_sagemaker_session)
      event_bridge_rule_helper = EventBridgeRuleHelper(
          _sagemaker_session,
          _sagemaker_session.boto_session.client("events"),
      )
      logger.info(
          "Creating/Updating EventBridge Rule for pipeline %s.",
          target_pipeline,
      )
      rule_arn = event_bridge_rule_helper.put_rule(
          source_pipeline_events=source_pipeline_events,
          target_pipeline=target_pipeline,
          event_pattern=event_pattern,
          state=state,
      )
      rule_name = _parse_name_from_arn(
          rule_arn, EVENTBRIDGE_RULE_ARN_REGEX_PATTERN
      )
      logger.info(
          "Created/Updated EventBridge Rule  for pipeline %s.",
          target_pipeline,
      )
  
      logger.info(
          "Attaching pipeline %s to EventBridge Rule %s as target",
          target_pipeline,
          rule_arn,
      )
      event_bridge_rule_helper.put_target(
          rule_name=rule_name,
          target_pipeline=target_pipeline,
          target_pipeline_parameters=target_pipeline_parameters,
          role_arn=_role_arn,
      )
      logger.info(
          "Attached pipeline %s to EventBridge Rule %s as target",
          target_pipeline,
          rule_arn,
      )
  
      describe_pipeline_response = (
          _sagemaker_session.sagemaker_client.describe_pipeline(
              PipelineName=target_pipeline
          )
      )
      describe_rule_response = event_bridge_rule_helper.describe_rule(
          rule_name=rule_name
      )
      pipeline_arn = describe_pipeline_response["PipelineArn"]
      tags_propagate_to_lineage_resources = (
          _get_tags_from_pipeline_to_propagate_to_lineage_resources(
              pipeline_arn, _sagemaker_session
          )
      )
  
      event_bridge_rule_helper.add_tags(
          rule_arn=rule_arn, tags=tags_propagate_to_lineage_resources
      )
  
      lineage_handler = FeatureProcessorLineageHandler(
          pipeline_name=target_pipeline,
          pipeline_arn=describe_pipeline_response["PipelineArn"],
          pipeline=describe_pipeline_response,
          sagemaker_session=_sagemaker_session,
      )
      lineage_handler.create_trigger_lineage(
          pipeline_name=target_pipeline,
          trigger_arn=rule_arn,
          state=state,
          tags=tags_propagate_to_lineage_resources,
          event_pattern=describe_rule_response["EventPattern"],
      )
      return rule_arn
  
imports: from __future__ import absolute_import
  import logging
  import json
  import re
  from datetime import datetime
  from typing import Callable, List, Optional, Dict, Sequence, Union, Any, Tuple
  import pytz
  from botocore.exceptions import ClientError
  from sagemaker.feature_store.feature_processor._config_uploader import ConfigUploader
  from sagemaker.feature_store.feature_processor._enums import FeatureProcessorMode
  from sagemaker.feature_store.feature_processor._event_bridge_rule_helper import EventBridgeRuleHelper
  from sagemaker.feature_store.feature_processor._feature_processor_pipeline_events import FeatureProcessorPipelineEvents
  from sagemaker.feature_store.feature_processor.lineage._feature_processor_lineage_name_helper import _get_feature_group_lineage_context_name, _get_feature_group_pipeline_lineage_context_name, _get_feature_group_pipeline_version_lineage_context_name, _get_feature_processor_pipeline_lineage_context_name, _get_feature_processor_pipeline_version_lineage_context_name
  from sagemaker.lineage import context
  from sagemaker.lineage._utils import get_resource_name_from_arn
  from sagemaker.remote_function.runtime_environment.runtime_environment_manager import RuntimeEnvironmentManager
  from sagemaker.remote_function.spark_config import SparkConfig
  from sagemaker.vpc_utils import SUBNETS_KEY, SECURITY_GROUP_IDS_KEY
  from sagemaker.feature_store.feature_processor._constants import EXECUTION_TIME_PIPELINE_PARAMETER, EXECUTION_TIME_PIPELINE_PARAMETER_FORMAT, RESOURCE_NOT_FOUND_EXCEPTION, SPARK_JAR_FILES_PATH, SPARK_PY_FILES_PATH, SPARK_FILES_PATH, FEATURE_PROCESSOR_TAG_KEY, FEATURE_PROCESSOR_TAG_VALUE, PIPELINE_CONTEXT_TYPE, DEFAULT_SCHEDULE_STATE, SCHEDULED_TIME_PIPELINE_PARAMETER, PIPELINE_CONTEXT_NAME_TAG_KEY, PIPELINE_VERSION_CONTEXT_NAME_TAG_KEY, PIPELINE_NAME_MAXIMUM_LENGTH, RESOURCE_NOT_FOUND, FEATURE_GROUP_ARN_REGEX_PATTERN, TO_PIPELINE_RESERVED_TAG_KEYS, DEFAULT_TRIGGER_STATE, EVENTBRIDGE_RULE_ARN_REGEX_PATTERN
  from sagemaker.feature_store.feature_processor._feature_processor_config import FeatureProcessorConfig
  from sagemaker.s3 import s3_path_join
  from sagemaker import Session, get_execution_role
  from sagemaker.feature_store.feature_processor._event_bridge_scheduler_helper import EventBridgeSchedulerHelper
  from sagemaker.workflow.pipeline import Pipeline
  from sagemaker.workflow.retry import StepRetryPolicy, StepExceptionTypeEnum, SageMakerJobStepRetryPolicy, SageMakerJobExceptionTypeEnum
  from sagemaker.workflow.steps import TrainingStep
  from sagemaker.estimator import Estimator
  from sagemaker.feature_store.feature_processor.lineage._feature_processor_lineage import FeatureProcessorLineageHandler, TransformationCode
  from sagemaker.remote_function.job import _JobSettings, JOBS_CONTAINER_ENTRYPOINT, SPARK_APP_SCRIPT_PATH
  from sagemaker.feature_store.feature_processor._data_source import CSVDataSource, FeatureGroupDataSource, ParquetDataSource
label_desc: Use image node_id 3 for calling a global function with example usage: put_trigger(source_pipeline_events, target_pipeline, target_pipeline_parameters, state, event_pattern, role_arn, sagemaker_session) and returns: rule_arn