class_docstr: Find, Create, Update, Execute and Delete AWS DataSync Tasks.
  
  If ``do_xcom_push`` is True, then the DataSync TaskArn and TaskExecutionArn
  which were executed will be pushed to an XCom.
  
  .. seealso::
      For more information on how to use this operator, take a look at the guide:
      :ref:`howto/operator:DataSyncOperator`
  
  .. note:: There may be 0, 1, or many existing DataSync Tasks defined in your AWS
      environment. The default behavior is to create a new Task if there are 0, or
      execute the Task if there was 1 Task, or fail if there were many Tasks.
  
  :param wait_interval_seconds: Time to wait between two
      consecutive calls to check TaskExecution status.
  :param max_iterations: Maximum number of
      consecutive calls to check TaskExecution status.
  :param wait_for_completion: If True, wait for the task execution to reach a final state
  :param task_arn: AWS DataSync TaskArn to use. If None, then this operator will
      attempt to either search for an existing Task or attempt to create a new Task.
  :param source_location_uri: Source location URI to search for. All DataSync
      Tasks with a LocationArn with this URI will be considered.
      Example: ``smb://server/subdir``
  :param destination_location_uri: Destination location URI to search for.
      All DataSync Tasks with a LocationArn with this URI will be considered.
      Example: ``s3://airflow_bucket/stuff``
  :param allow_random_task_choice: If multiple Tasks match, one must be chosen to
      execute. If allow_random_task_choice is True then a random one is chosen.
  :param allow_random_location_choice: If multiple Locations match, one must be chosen
      when creating a task. If allow_random_location_choice is True then a random one is chosen.
  :param create_task_kwargs: If no suitable TaskArn is identified,
      it will be created if ``create_task_kwargs`` is defined.
      ``create_task_kwargs`` is then used internally like this:
      ``boto3.create_task(**create_task_kwargs)``
      Example:  ``{'Name': 'xyz', 'Options': ..., 'Excludes': ..., 'Tags': ...}``
  :param create_source_location_kwargs: If no suitable LocationArn is found,
      a Location will be created if ``create_source_location_kwargs`` is defined.
      ``create_source_location_kwargs`` is then used internally like this:
      ``boto3.create_location_xyz(**create_source_location_kwargs)``
      The xyz is determined from the prefix of source_location_uri, eg ``smb:/...`` or ``s3:/...``
      Example:  ``{'Subdirectory': ..., 'ServerHostname': ..., ...}``
  :param create_destination_location_kwargs: If no suitable LocationArn is found,
      a Location will be created if ``create_destination_location_kwargs`` is defined.
      ``create_destination_location_kwargs`` is used internally like this:
      ``boto3.create_location_xyz(**create_destination_location_kwargs)``
      The xyz is determined from the prefix of destination_location_uri, eg ``smb:/...` or ``s3:/...``
      Example:  ``{'S3BucketArn': ..., 'S3Config': {'BucketAccessRoleArn': ...}, ...}``
  :param update_task_kwargs:  If a suitable TaskArn is found or created,
      it will be updated if ``update_task_kwargs`` is defined.
      ``update_task_kwargs`` is used internally like this:
      ``boto3.update_task(TaskArn=task_arn, **update_task_kwargs)``
      Example:  ``{'Name': 'xyz', 'Options': ..., 'Excludes': ...}``
  :param task_execution_kwargs: Additional kwargs passed directly when starting the
      Task execution, used internally like this:
      ``boto3.start_task_execution(TaskArn=task_arn, **task_execution_kwargs)``
  :param  delete_task_after_execution: If True then the TaskArn which was executed
      will be deleted from AWS DataSync on successful completion.
  :param aws_conn_id: The Airflow connection used for AWS credentials.
      If this is ``None`` or empty then the default boto3 behaviour is used. If
      running Airflow in a distributed manner and aws_conn_id is None or
      empty, then default boto3 configuration would be used (and must be
      maintained on each worker node).
  :param region_name: AWS region_name. If not specified then the default boto3 behaviour is used.
  :param verify: Whether or not to verify SSL certificates. See:
      https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html
  :param botocore_config: Configuration dictionary (key-values) for botocore client. See:
      https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html
  :raises AirflowException: If ``task_arn`` was not specified, or if
      either ``source_location_uri`` or ``destination_location_uri`` were
      not specified.
  :raises AirflowException: If source or destination Location were not found
      and could not be created.
  :raises AirflowException: If ``choose_task`` or ``choose_location`` fails.
  :raises AirflowException: If Task creation, update, execution or delete fails.
docstr: Create a AWS DataSyncTask.
docstr_tok: ["Create","a","AWS","DataSyncTask","."]
code: def _create_datasync_task(self) -> None:
      """Create a AWS DataSyncTask."""
      self.source_location_arn = self.choose_location(
          self.candidate_source_location_arns
      )
      if (
          not self.source_location_arn
          and self.source_location_uri
          and self.create_source_location_kwargs
      ):
          self.log.info("Attempting to create source Location")
          self.source_location_arn = self.hook.create_location(
              self.source_location_uri,
              **self.create_source_location_kwargs,
          )
      if not self.source_location_arn:
          raise AirflowException(
              "Unable to determine source LocationArn. Does a suitable DataSync Location exist?"
          )
  
      self.destination_location_arn = self.choose_location(
          self.candidate_destination_location_arns
      )
      if (
          not self.destination_location_arn
          and self.destination_location_uri
          and self.create_destination_location_kwargs
      ):
          self.log.info("Attempting to create destination Location")
          self.destination_location_arn = self.hook.create_location(
              self.destination_location_uri,
              **self.create_destination_location_kwargs,
          )
      if not self.destination_location_arn:
          raise AirflowException(
              "Unable to determine destination LocationArn. Does a suitable DataSync Location exist?"
          )
  
      self.log.info("Creating a Task.")
      self.task_arn = self.hook.create_task(
          self.source_location_arn,
          self.destination_location_arn,
          **self.create_task_kwargs,
      )
      if not self.task_arn:
          raise AirflowException("Task could not be created")
      self.log.info("Created a Task with TaskArn %s", self.task_arn)
  
imports: from __future__ import annotations
  import logging
  import random
  from typing import TYPE_CHECKING, Any, Sequence
  from deprecated.classic import deprecated
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning, AirflowTaskTimeout
  from airflow.providers.amazon.aws.hooks.datasync import DataSyncHook
  from airflow.providers.amazon.aws.operators.base_aws import AwsBaseOperator
  from airflow.providers.amazon.aws.utils.mixins import aws_template_fields
label_desc: Use image node_id 8 for calling the DataSyncOperator obj's underlying member method code with example usage: obj._create_datasync_task() without return types