Skip to content

create_scheduled_action async

create_scheduled_action(
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    scheduled_action_name: Optional[String] = None,
    target_action: Optional[ScheduledActionType] = None,
    schedule: Optional[String] = None,
    iam_role: Optional[String] = None,
    scheduled_action_description: Optional[String] = None,
    start_time: Optional[TStamp] = None,
    end_time: Optional[TStamp] = None,
    enable: Optional[BooleanOptional] = None,
) -> ScheduledAction

Creates a scheduled action. A scheduled action contains a schedule and an Amazon Redshift API action. For example, you can create a schedule of when to run the ResizeCluster API operation.

Parameters:

  • scheduled_action_name (Optional[String], default: None ) –

    The name of the scheduled action. The name must be unique within an account. For more information about this parameter, see ScheduledAction.

  • target_action (Optional[ScheduledActionType], default: None ) –

    A JSON format string of the Amazon Redshift API operation with input parameters. For more information about this parameter, see ScheduledAction.

  • schedule (Optional[String], default: None ) –

    The schedule in at( ) or cron( ) format. For more information about this parameter, see ScheduledAction.

  • iam_role (Optional[String], default: None ) –

    The IAM role to assume to run the target action. For more information about this parameter, see ScheduledAction.

  • scheduled_action_description (Optional[String], default: None ) –

    The description of the scheduled action.

  • start_time (Optional[TStamp], default: None ) –

    The start time in UTC of the scheduled action. Before this time, the scheduled action does not trigger. For more information about this parameter, see ScheduledAction.

  • end_time (Optional[TStamp], default: None ) –

    The end time in UTC of the scheduled action. After this time, the scheduled action does not trigger. For more information about this parameter, see ScheduledAction.

  • enable (Optional[BooleanOptional], default: None ) –

    If true, the schedule is enabled. If false, the scheduled action does not trigger. For more information about state of the scheduled action, see ScheduledAction.

Raises:

Source code in docs_src/capo_redshift/_services/async_redshift.py
async def create_scheduled_action(
    self,
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    scheduled_action_name: Optional["capo_redshift.types.string.String"] = None,
    target_action: Optional[
        "capo_redshift.types.scheduled_action_type.ScheduledActionType"
    ] = None,
    schedule: Optional["capo_redshift.types.string.String"] = None,
    iam_role: Optional["capo_redshift.types.string.String"] = None,
    scheduled_action_description: Optional[
        "capo_redshift.types.string.String"
    ] = None,
    start_time: Optional["capo_redshift.types.t_stamp.TStamp"] = None,
    end_time: Optional["capo_redshift.types.t_stamp.TStamp"] = None,
    enable: Optional["capo_redshift.types.boolean_optional.BooleanOptional"] = None,
) -> "capo_redshift.types.scheduled_action.ScheduledAction":
    """<p>Creates a scheduled action. A scheduled action contains a schedule and an Amazon Redshift API action. For example, you can create a schedule of when to run the <code>ResizeCluster</code> API operation. </p>

    Args:
        scheduled_action_name: <p>The name of the scheduled action. The name must be unique within an account. For more information about this parameter, see <a>ScheduledAction</a>. </p>
        target_action: <p>A JSON format string of the Amazon Redshift API operation with input parameters. For more information about this parameter, see <a>ScheduledAction</a>. </p>
        schedule: <p>The schedule in <code>at( )</code> or <code>cron( )</code> format. For more information about this parameter, see <a>ScheduledAction</a>.</p>
        iam_role: <p>The IAM role to assume to run the target action. For more information about this parameter, see <a>ScheduledAction</a>. </p>
        scheduled_action_description: <p>The description of the scheduled action. </p>
        start_time: <p>The start time in UTC of the scheduled action. Before this time, the scheduled action does not trigger. For more information about this parameter, see <a>ScheduledAction</a>.</p>
        end_time: <p>The end time in UTC of the scheduled action. After this time, the scheduled action does not trigger. For more information about this parameter, see <a>ScheduledAction</a>. </p>
        enable: <p>If true, the schedule is enabled. If false, the scheduled action does not trigger. For more information about <code>state</code> of the scheduled action, see <a>ScheduledAction</a>. </p>

    Raises:
        capo_redshift.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster. </p>
        capo_redshift.errors.invalid_scheduled_action_fault.InvalidScheduledActionFault: <p>The scheduled action is not valid. </p>
        capo_redshift.errors.invalid_schedule_fault.InvalidScheduleFault: <p>The schedule you submitted isn't valid.</p>
        capo_redshift.errors.scheduled_action_already_exists_fault.ScheduledActionAlreadyExistsFault: <p>The scheduled action already exists. </p>
        capo_redshift.errors.scheduled_action_quota_exceeded_fault.ScheduledActionQuotaExceededFault: <p>The quota for scheduled actions exceeded. </p>
        capo_redshift.errors.scheduled_action_type_unsupported_fault.ScheduledActionTypeUnsupportedFault: <p>The action type specified for a scheduled action is not supported. </p>
        capo_redshift.errors.unauthorized_operation.UnauthorizedOperation: <p>Your account is not authorized to perform the requested operation.</p>
        capo_redshift.errors.unsupported_operation_fault.UnsupportedOperationFault: <p>The requested operation isn't supported.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift.types.create_scheduled_action_message.CreateScheduledActionMessage]",
    ) -> AsyncOperationResponse[
        "capo_redshift.types.scheduled_action.ScheduledAction"
    ]:
        import capo_redshift._operations.redshift_service_version20121201.create_scheduled_action

        (
            output,
            http_response,
        ) = await capo_redshift._operations.redshift_service_version20121201.create_scheduled_action.async_create_scheduled_action(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateScheduledAction")
    )
    input_: capo_redshift.types.create_scheduled_action_message.CreateScheduledActionMessage = {}
    if scheduled_action_name is not None:
        input_["scheduled_action_name"] = scheduled_action_name
    if target_action is not None:
        input_["target_action"] = target_action
    if schedule is not None:
        input_["schedule"] = schedule
    if iam_role is not None:
        input_["iam_role"] = iam_role
    if scheduled_action_description is not None:
        input_["scheduled_action_description"] = scheduled_action_description
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if enable is not None:
        input_["enable"] = enable

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output