Skip to content

create_library_item

create_library_item(
    instance_id: InstanceId,
    app_id: UUID,
    app_version: AppVersion,
    categories: CategoryIdList,
    *,
    config_overrides: Optional[QAppsClientConfig] = None,
) -> CreateLibraryItemOutput

Creates a new library item for an Amazon Q App, allowing it to be discovered and used by other allowed users.

Parameters:

  • instance_id (InstanceId) –

    The unique identifier of the Amazon Q Business application environment instance.

  • app_id (UUID) –

    The unique identifier of the Amazon Q App to publish to the library.

  • app_version (AppVersion) –

    The version of the Amazon Q App to publish to the library.

  • categories (CategoryIdList) –

    The categories to associate with the library item for easier discovery.

Raises:

Examples:

Create a Library Item

>>> client.create_library_item(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', app_id='7a11f34b-42d4-4bc8-b668-ae4a788dae1e', app_version=6, categories=['9c871ed4-1c41-4065-aefe-321cd4b61cf8'])
Source code in docs_src/capo_qapps/_services/q_apps.py
def create_library_item(
    self,
    instance_id: "capo_qapps.types.instance_id.InstanceId",
    app_id: "capo_qapps.types.uuid.UUID",
    app_version: "capo_qapps.types.app_version.AppVersion",
    categories: "capo_qapps.types.category_id_list.CategoryIdList",
    *,
    config_overrides: Optional[QAppsClientConfig] = None,
) -> "capo_qapps.types.create_library_item_output.CreateLibraryItemOutput":
    """<p>Creates a new library item for an Amazon Q App, allowing it to be discovered and used by other allowed users. </p>

    Args:
        instance_id: <p>The unique identifier of the Amazon Q Business application environment instance.</p>
        app_id: <p>The unique identifier of the Amazon Q App to publish to the library.</p>
        app_version: <p>The version of the Amazon Q App to publish to the library.</p>
        categories: <p>The categories to associate with the library item for easier discovery.</p>

    Raises:
        capo_qapps.errors.access_denied_exception.AccessDeniedException: <p>The client is not authorized to perform the requested operation.</p>
        capo_qapps.errors.internal_server_exception.InternalServerException: <p>An internal service error occurred while processing the request.</p>
        capo_qapps.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_qapps.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The requested operation could not be completed because it would exceed the service's quota or limit.</p>
        capo_qapps.errors.throttling_exception.ThrottlingException: <p>The requested operation could not be completed because too many requests were sent at once. Wait a bit and try again later.</p>
        capo_qapps.errors.unauthorized_exception.UnauthorizedException: <p>The client is not authenticated or authorized to perform the requested operation.</p>
        capo_qapps.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by the service.</p>
        capo_qapps.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create a Library Item

        >>> client.create_library_item(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', app_id='7a11f34b-42d4-4bc8-b668-ae4a788dae1e', app_version=6, categories=['9c871ed4-1c41-4065-aefe-321cd4b61cf8'])
    """

    def _handler(
        req: "OperationRequest[capo_qapps.types.create_library_item_input.CreateLibraryItemInput]",
    ) -> OperationResponse[
        "capo_qapps.types.create_library_item_output.CreateLibraryItemOutput"
    ]:
        import capo_qapps._operations.q_apps_service.create_library_item

        output, http_response = (
            capo_qapps._operations.q_apps_service.create_library_item.create_library_item(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLibraryItem")
    )
    input_: capo_qapps.types.create_library_item_input.CreateLibraryItemInput = {
        "instance_id": instance_id,
        "app_id": app_id,
        "app_version": app_version,
        "categories": categories,
    }

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