Skip to content

create_task

create_task(
    targets: TargetList,
    command: Command,
    *,
    config_overrides: Optional[SnowDeviceManagementClientConfig] = None,
    description: Optional[TaskDescriptionString] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[IdempotencyToken] = None,
) -> CreateTaskOutput

Instructs one or more devices to start a task, such as unlocking or rebooting.

Parameters:

  • targets (TargetList) –

    A list of managed device IDs.

  • command (Command) –

    The task to be performed. Only one task is executed on a device at a time.

  • description (Optional[TaskDescriptionString], default: None ) –

    A description of the task and its targets.

  • tags (Optional[TagMap], default: None ) –

    Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A token ensuring that the action is called only once with the specified details.

Raises:

Source code in docs_src/capo_snow_device_management/_services/snow_device_management.py
def create_task(
    self,
    targets: "capo_snow_device_management.types.target_list.TargetList",
    command: "capo_snow_device_management.types.command.Command",
    *,
    config_overrides: Optional[SnowDeviceManagementClientConfig] = None,
    description: Optional[
        "capo_snow_device_management.types.task_description_string.TaskDescriptionString"
    ] = None,
    tags: Optional["capo_snow_device_management.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_snow_device_management.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_snow_device_management.types.create_task_output.CreateTaskOutput":
    """<p>Instructs one or more devices to start a task, such as unlocking or rebooting.</p>

    Args:
        targets: <p>A list of managed device IDs.</p>
        command: <p>The task to be performed. Only one task is executed on a device at a time.</p>
        description: <p>A description of the task and its targets.</p>
        tags: <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment. </p>
        client_token: <p>A token ensuring that the action is called only once with the specified details.</p>

    Raises:
        capo_snow_device_management.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_snow_device_management.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing the request.</p>
        capo_snow_device_management.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that doesn't exist.</p>
        capo_snow_device_management.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_snow_device_management.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_snow_device_management.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_snow_device_management.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_snow_device_management.types.create_task_input.CreateTaskInput]",
    ) -> OperationResponse[
        "capo_snow_device_management.types.create_task_output.CreateTaskOutput"
    ]:
        import capo_snow_device_management._operations.snow_device_management.create_task

        output, http_response = (
            capo_snow_device_management._operations.snow_device_management.create_task.create_task(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTask")
    )
    input_: capo_snow_device_management.types.create_task_input.CreateTaskInput = {
        "targets": targets,
        "command": command,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output