Skip to content

create_q_app async

create_q_app(
    instance_id: InstanceId,
    title: Title,
    app_definition: AppDefinitionInput,
    *,
    config_overrides: Optional[AsyncQAppsClientConfig] = None,
    description: Optional[Description] = None,
    tags: Optional[TagMap] = None,
) -> CreateQAppOutput

Creates a new Amazon Q App based on the provided definition. The Q App definition specifies the cards and flow of the Q App. This operation also calculates the dependencies between the cards by inspecting the references in the prompts.

Parameters:

  • instance_id (InstanceId) –

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

  • title (Title) –

    The title of the new Q App.

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

    The description of the new Q App.

  • app_definition (AppDefinitionInput) –

    The definition of the new Q App, specifying the cards and flow.

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

    Optional tags to associate with the new Q App.

Raises:

  • AccessDeniedException –

    The client is not authorized to perform the requested operation.

  • ConflictException –

    The requested operation could not be completed due to a conflict with the current state of the resource.

  • ContentTooLargeException –

    The requested operation could not be completed because the content exceeds the maximum allowed size.

  • InternalServerException –

    An internal service error occurred while processing the request.

  • ServiceQuotaExceededException –

    The requested operation could not be completed because it would exceed the service's quota or limit.

  • ThrottlingException –

    The requested operation could not be completed because too many requests were sent at once. Wait a bit and try again later.

  • UnauthorizedException –

    The client is not authenticated or authorized to perform the requested operation.

  • ValidationException –

    The input failed to satisfy the constraints specified by the service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

A basic application with 1 text input card and 1 output card

>>> await client.create_q_app(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', title='Color Palette Generator', app_definition={'cards': [{'textInput': {'type': 'text-input', 'title': 'Color Base', 'id': '4cf94d96-8819-45c2-98cc-58c56b35c72f'}}, {'qQuery': {'type': 'q-query', 'title': 'Recommended Palette', 'id': '18870b94-1e63-40e0-8c12-669c90ac5acc', 'prompt': 'Recommend me a list of colors that go well with @4cf94d96-8819-45c2-98cc-58c56b35c72f'}}], 'initialPrompt': 'Create an app that recommend a list of colors based on input.'})
Source code in docs_src/capo_qapps/_services/async_q_apps.py
async def create_q_app(
    self,
    instance_id: "capo_qapps.types.instance_id.InstanceId",
    title: "capo_qapps.types.title.Title",
    app_definition: "capo_qapps.types.app_definition_input.AppDefinitionInput",
    *,
    config_overrides: Optional[AsyncQAppsClientConfig] = None,
    description: Optional["capo_qapps.types.description.Description"] = None,
    tags: Optional["capo_qapps.types.tag_map.TagMap"] = None,
) -> "capo_qapps.types.create_q_app_output.CreateQAppOutput":
    """<p>Creates a new Amazon Q App based on the provided definition. The Q App definition specifies the cards and flow of the Q App. This operation also calculates the dependencies between the cards by inspecting the references in the prompts. </p>

    Args:
        instance_id: <p>The unique identifier of the Amazon Q Business application environment instance.</p>
        title: <p>The title of the new Q App.</p>
        description: <p>The description of the new Q App.</p>
        app_definition: <p>The definition of the new Q App, specifying the cards and flow.</p>
        tags: <p>Optional tags to associate with the new Q App.</p>

    Raises:
        capo_qapps.errors.access_denied_exception.AccessDeniedException: <p>The client is not authorized to perform the requested operation.</p>
        capo_qapps.errors.conflict_exception.ConflictException: <p>The requested operation could not be completed due to a conflict with the current state of the resource.</p>
        capo_qapps.errors.content_too_large_exception.ContentTooLargeException: <p>The requested operation could not be completed because the content exceeds the maximum allowed size.</p>
        capo_qapps.errors.internal_server_exception.InternalServerException: <p>An internal service error occurred while processing the request.</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:
        A basic application with 1 text input card and 1 output card

        >>> await client.create_q_app(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', title='Color Palette Generator', app_definition={'cards': [{'textInput': {'type': 'text-input', 'title': 'Color Base', 'id': '4cf94d96-8819-45c2-98cc-58c56b35c72f'}}, {'qQuery': {'type': 'q-query', 'title': 'Recommended Palette', 'id': '18870b94-1e63-40e0-8c12-669c90ac5acc', 'prompt': 'Recommend me a list of colors that go well with @4cf94d96-8819-45c2-98cc-58c56b35c72f'}}], 'initialPrompt': 'Create an app that recommend a list of colors based on input.'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_qapps.types.create_q_app_input.CreateQAppInput]",
    ) -> AsyncOperationResponse[
        "capo_qapps.types.create_q_app_output.CreateQAppOutput"
    ]:
        import capo_qapps._operations.q_apps_service.create_q_app

        (
            output,
            http_response,
        ) = await capo_qapps._operations.q_apps_service.create_q_app.async_create_q_app(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateQApp")
    )
    input_: capo_qapps.types.create_q_app_input.CreateQAppInput = {
        "instance_id": instance_id,
        "title": title,
        "app_definition": app_definition,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

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