Skip to content

put_items async

put_items(
    dataset_arn: Arn,
    items: ItemList,
    *,
    config_overrides: Optional[AsyncPersonalizeEventsClientConfig] = None,
) -> None

Adds one or more items to an Items dataset. For more information see Importing items individually.

Parameters:

  • dataset_arn (Arn) –

    The Amazon Resource Name (ARN) of the Items dataset you are adding the item or items to.

  • items (ItemList) –

    A list of item data.

Raises:

Source code in docs_src/capo_personalize_events/_services/async_personalize_events.py
async def put_items(
    self,
    dataset_arn: "capo_personalize_events.types.arn.Arn",
    items: "capo_personalize_events.types.item_list.ItemList",
    *,
    config_overrides: Optional[AsyncPersonalizeEventsClientConfig] = None,
) -> None:
    """<p>Adds one or more items to an Items dataset. For more information see <a href="https://docs.aws.amazon.com/personalize/latest/dg/importing-items.html">Importing items individually</a>. </p>

    Args:
        dataset_arn: <p>The Amazon Resource Name (ARN) of the Items dataset you are adding the item or items to.</p>
        items: <p>A list of item data.</p>

    Raises:
        capo_personalize_events.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
        capo_personalize_events.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
        capo_personalize_events.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
        capo_personalize_events.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_personalize_events.types.put_items_request.PutItemsRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_personalize_events._operations.amazon_personalize_events.put_items

        (
            output,
            http_response,
        ) = await capo_personalize_events._operations.amazon_personalize_events.put_items.async_put_items(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_personalize_events.types.put_items_request.PutItemsRequest",
    ) -> dict[str, Any]:
        import capo_personalize_events.types.put_items_request

        return capo_personalize_events.types.put_items_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutItems", redact_input=_redact_input)
    )
    input_: capo_personalize_events.types.put_items_request.PutItemsRequest = {
        "dataset_arn": dataset_arn,
        "items": items,
    }

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