Skip to content

create_theme

create_theme(
    app_id: str,
    environment_name: str,
    theme_to_create: CreateThemeData,
    *,
    config_overrides: Optional[AmplifyUIBuilderClientConfig] = None,
    client_token: Optional[str] = None,
) -> CreateThemeResponse

Creates a theme to apply to the components in an Amplify app.

Parameters:

  • app_id (str) –

    The unique ID of the Amplify app associated with the theme.

  • environment_name (str) –

    The name of the backend environment that is a part of the Amplify app.

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

    The unique client token.

  • theme_to_create (CreateThemeData) –

    Represents the configuration of the theme to create.

Raises:

Source code in docs_src/capo_amplifyuibuilder/_services/amplify_ui_builder.py
def create_theme(
    self,
    app_id: str,
    environment_name: str,
    theme_to_create: "capo_amplifyuibuilder.types.create_theme_data.CreateThemeData",
    *,
    config_overrides: Optional[AmplifyUIBuilderClientConfig] = None,
    client_token: Optional[str] = None,
) -> "capo_amplifyuibuilder.types.create_theme_response.CreateThemeResponse":
    """<p>Creates a theme to apply to the components in an Amplify app.</p>

    Args:
        app_id: <p>The unique ID of the Amplify app associated with the theme.</p>
        environment_name: <p>The name of the backend environment that is a part of the Amplify app.</p>
        client_token: <p>The unique client token.</p>
        theme_to_create: <p>Represents the configuration of the theme to create.</p>

    Raises:
        capo_amplifyuibuilder.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Please retry your request.</p>
        capo_amplifyuibuilder.errors.invalid_parameter_exception.InvalidParameterException: <p>An invalid or out-of-range value was supplied for the input parameter.</p>
        capo_amplifyuibuilder.errors.resource_conflict_exception.ResourceConflictException: <p>The resource specified in the request conflicts with an existing resource.</p>
        capo_amplifyuibuilder.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You exceeded your service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account. </p>
        capo_amplifyuibuilder.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amplifyuibuilder.types.create_theme_request.CreateThemeRequest]",
    ) -> OperationResponse[
        "capo_amplifyuibuilder.types.create_theme_response.CreateThemeResponse"
    ]:
        import capo_amplifyuibuilder._operations.amplify_ui_builder.create_theme

        output, http_response = (
            capo_amplifyuibuilder._operations.amplify_ui_builder.create_theme.create_theme(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTheme")
    )
    input_: capo_amplifyuibuilder.types.create_theme_request.CreateThemeRequest = {
        "app_id": app_id,
        "environment_name": environment_name,
        "theme_to_create": theme_to_create,
    }
    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