Creates a new set of branding settings for a user pool style and associates it with an app client. This operation is the programmatic option for the creation of a new style in the branding editor.
Provides values for UI customization in a Settings JSON object and image files in an Assets array. To send the JSON object Document type parameter in Settings, you might need to update to the most recent version of your Amazon Web Services SDK. To create a new style with default settings, set UseCognitoProvidedValues to true and don't provide values for any other options.
This operation has a 2-megabyte request-size limit and include the CSS settings and image assets for your app client. Your branding settings might exceed 2MB in size. Amazon Cognito doesn't require that you pass all parameters in one request and preserves existing style settings that you don't specify. If your request is larger than 2MB, separate it into multiple requests, each with a size smaller than the limit.
Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.
Learn more
Parameters:
-
user_pool_id
(UserPoolIdType)
–
The ID of the user pool where you want to create a new branding style.
-
client_id
(ClientIdType)
–
The app client that you want to create the branding style for. Each style is linked to an app client until you delete it.
-
use_cognito_provided_values
(Optional[BooleanType], default:
None
)
–
When true, applies the default branding style options. These default options are managed by Amazon Cognito. You can modify them later in the branding editor.
When you specify true for this option, you must also omit values for Settings and Assets in the request.
-
settings
(Optional[Document], default:
None
)
–
A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.
The following components are not currently implemented and reserved for future use:
-
assets
(Optional[AssetListType], default:
None
)
–
An array of image files that you want to apply to functions like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.
Raises:
-
ConcurrentModificationException
–
This exception is thrown if two or more modifications are happening concurrently.
-
InternalErrorException
–
This exception is thrown when Amazon Cognito encounters an internal error.
-
InvalidParameterException
–
This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
-
LimitExceededException
–
This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.
-
ManagedLoginBrandingExistsException
–
This exception is thrown when you attempt to apply a managed login branding style to an app client that already has an assigned style.
-
NotAuthorizedException
–
This exception is thrown when a user isn't authorized.
-
OperationNotEnabledException
–
This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.
-
ResourceNotFoundException
–
This exception is thrown when the Amazon Cognito service can't find the requested resource.
-
TooManyRequestsException
–
This exception is thrown when the user has made too many requests for a given operation.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_cognito_identity_provider/_services/cognito_identity_provider.py
| def create_managed_login_branding(
self,
user_pool_id: "capo_cognito_identity_provider.types.user_pool_id_type.UserPoolIdType",
client_id: "capo_cognito_identity_provider.types.client_id_type.ClientIdType",
*,
config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
use_cognito_provided_values: Optional[
"capo_cognito_identity_provider.types.boolean_type.BooleanType"
] = None,
settings: Optional[
"capo_cognito_identity_provider.types.document.Document"
] = None,
assets: Optional[
"capo_cognito_identity_provider.types.asset_list_type.AssetListType"
] = None,
) -> "capo_cognito_identity_provider.types.create_managed_login_branding_response.CreateManagedLoginBrandingResponse":
"""<p>Creates a new set of branding settings for a user pool style and associates it with an app client. This operation is the programmatic option for the creation of a new style in the branding editor.</p> <p>Provides values for UI customization in a <code>Settings</code> JSON object and image files in an <code>Assets</code> array. To send the JSON object <code>Document</code> type parameter in <code>Settings</code>, you might need to update to the most recent version of your Amazon Web Services SDK. To create a new style with default settings, set <code>UseCognitoProvidedValues</code> to <code>true</code> and don't provide values for any other options.</p> <p> This operation has a 2-megabyte request-size limit and include the CSS settings and image assets for your app client. Your branding settings might exceed 2MB in size. Amazon Cognito doesn't require that you pass all parameters in one request and preserves existing style settings that you don't specify. If your request is larger than 2MB, separate it into multiple requests, each with a size smaller than the limit. </p> <note> <p>Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.</p> <p class="title"> <b>Learn more</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html">Signing Amazon Web Services API Requests</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a> </p> </li> </ul> </note>
Args:
user_pool_id: <p>The ID of the user pool where you want to create a new branding style.</p>
client_id: <p>The app client that you want to create the branding style for. Each style is linked to an app client until you delete it.</p>
use_cognito_provided_values: <p>When true, applies the default branding style options. These default options are managed by Amazon Cognito. You can modify them later in the branding editor.</p> <p>When you specify <code>true</code> for this option, you must also omit values for <code>Settings</code> and <code>Assets</code> in the request.</p>
settings: <p>A JSON file, encoded as a <code>Document</code> type, with the the settings that you want to apply to your style.</p> <p>The following components are not currently implemented and reserved for future use:</p> <ul> <li> <p> <code>signUp</code> </p> </li> <li> <p> <code>instructions</code> </p> </li> <li> <p> <code>sessionTimerDisplay</code> </p> </li> <li> <p> <code>languageSelector</code> (for localization, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html#managed-login-localization">Managed login localization)</a> </p> </li> </ul>
assets: <p>An array of image files that you want to apply to functions like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.</p>
Raises:
capo_cognito_identity_provider.errors.concurrent_modification_exception.ConcurrentModificationException: <p>This exception is thrown if two or more modifications are happening concurrently.</p>
capo_cognito_identity_provider.errors.internal_error_exception.InternalErrorException: <p>This exception is thrown when Amazon Cognito encounters an internal error.</p>
capo_cognito_identity_provider.errors.invalid_parameter_exception.InvalidParameterException: <p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>
capo_cognito_identity_provider.errors.limit_exceeded_exception.LimitExceededException: <p>This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.</p>
capo_cognito_identity_provider.errors.managed_login_branding_exists_exception.ManagedLoginBrandingExistsException: <p>This exception is thrown when you attempt to apply a managed login branding style to an app client that already has an assigned style.</p>
capo_cognito_identity_provider.errors.not_authorized_exception.NotAuthorizedException: <p>This exception is thrown when a user isn't authorized.</p>
capo_cognito_identity_provider.errors.operation_not_enabled_exception.OperationNotEnabledException: <p>This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.</p>
capo_cognito_identity_provider.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when the Amazon Cognito service can't find the requested resource.</p>
capo_cognito_identity_provider.errors.too_many_requests_exception.TooManyRequestsException: <p>This exception is thrown when the user has made too many requests for a given operation.</p>
capo_cognito_identity_provider.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cognito_identity_provider.types.create_managed_login_branding_request.CreateManagedLoginBrandingRequest]",
) -> OperationResponse[
"capo_cognito_identity_provider.types.create_managed_login_branding_response.CreateManagedLoginBrandingResponse"
]:
import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.create_managed_login_branding
output, http_response = (
capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.create_managed_login_branding.create_managed_login_branding(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_cognito_identity_provider.types.create_managed_login_branding_request.CreateManagedLoginBrandingRequest",
) -> dict[str, Any]:
import capo_cognito_identity_provider.types.create_managed_login_branding_request
return capo_cognito_identity_provider.types.create_managed_login_branding_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateManagedLoginBranding", redact_input=_redact_input),
)
input_: capo_cognito_identity_provider.types.create_managed_login_branding_request.CreateManagedLoginBrandingRequest = {
"user_pool_id": user_pool_id,
"client_id": client_id,
}
if use_cognito_provided_values is not None:
input_["use_cognito_provided_values"] = use_cognito_provided_values
if settings is not None:
input_["settings"] = settings
if assets is not None:
input_["assets"] = assets
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|