Skip to content

update_terms async

update_terms(
    terms_id: TermsIdType,
    user_pool_id: UserPoolIdType,
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    terms_name: Optional[TermsNameType] = None,
    terms_source: Optional[TermsSourceType] = None,
    enforcement: Optional[TermsEnforcementType] = None,
    links: Optional[LinksType] = None,
) -> UpdateTermsResponse

Modifies existing terms documents for the requested app client. When Terms and conditions and Privacy policy documents are configured, the app client displays links to them in the sign-up page of managed login for the app client.

You can provide URLs for terms documents in the languages that are supported by managed login localization. Amazon Cognito directs users to the terms documents for their current language, with fallback to default if no document exists for the language.

Each request accepts one type of terms document and a map of language-to-link for that document type. You must provide both types of terms documents in at least one language before Amazon Cognito displays your terms documents. Supply each type in separate requests.

For more information, see Terms documents.

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:

  • terms_id (TermsIdType) –

    The ID of the terms document that you want to update.

  • user_pool_id (UserPoolIdType) –

    The ID of the user pool that contains the terms that you want to update.

  • terms_name (Optional[TermsNameType], default: None ) –

    The new name that you want to apply to the requested terms documents.

  • terms_source (Optional[TermsSourceType], default: None ) –

    This parameter is reserved for future use and currently accepts only one value.

  • enforcement (Optional[TermsEnforcementType], default: None ) –

    This parameter is reserved for future use and currently accepts only one value.

  • links (Optional[LinksType], default: None ) –

    A map of URLs to languages. For each localized language that will view the requested TermsName, assign a URL. A selection of cognito:default displays for all languages that don't have a language-specific URL.

    For example, "cognito:default": "https://terms.example.com", "cognito:spanish": "https://terms.example.com/es".

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.

  • 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.

  • TermsExistsException –

    Terms document names must be unique to the app client. This exception is thrown when you attempt to create terms documents with a duplicate TermsName.

  • 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/async_cognito_identity_provider.py
async def update_terms(
    self,
    terms_id: "capo_cognito_identity_provider.types.terms_id_type.TermsIdType",
    user_pool_id: "capo_cognito_identity_provider.types.user_pool_id_type.UserPoolIdType",
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    terms_name: Optional[
        "capo_cognito_identity_provider.types.terms_name_type.TermsNameType"
    ] = None,
    terms_source: Optional[
        "capo_cognito_identity_provider.types.terms_source_type.TermsSourceType"
    ] = None,
    enforcement: Optional[
        "capo_cognito_identity_provider.types.terms_enforcement_type.TermsEnforcementType"
    ] = None,
    links: Optional[
        "capo_cognito_identity_provider.types.links_type.LinksType"
    ] = None,
) -> (
    "capo_cognito_identity_provider.types.update_terms_response.UpdateTermsResponse"
):
    """<p>Modifies existing terms documents for the requested app client. When Terms and conditions and Privacy policy documents are configured, the app client displays links to them in the sign-up page of managed login for the app client.</p> <p>You can provide URLs for terms documents in the languages that are supported by <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html#managed-login-localization">managed login localization</a>. Amazon Cognito directs users to the terms documents for their current language, with fallback to <code>default</code> if no document exists for the language.</p> <p>Each request accepts one type of terms document and a map of language-to-link for that document type. You must provide both types of terms documents in at least one language before Amazon Cognito displays your terms documents. Supply each type in separate requests.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html#managed-login-terms-documents">Terms documents</a>.</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:
        terms_id: <p>The ID of the terms document that you want to update.</p>
        user_pool_id: <p>The ID of the user pool that contains the terms that you want to update.</p>
        terms_name: <p>The new name that you want to apply to the requested terms documents.</p>
        terms_source: <p>This parameter is reserved for future use and currently accepts only one value.</p>
        enforcement: <p>This parameter is reserved for future use and currently accepts only one value.</p>
        links: <p>A map of URLs to languages. For each localized language that will view the requested <code>TermsName</code>, assign a URL. A selection of <code>cognito:default</code> displays for all languages that don't have a language-specific URL.</p> <p>For example, <code>"cognito:default": "https://terms.example.com", "cognito:spanish": "https://terms.example.com/es"</code>.</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.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.terms_exists_exception.TermsExistsException: <p>Terms document names must be unique to the app client. This exception is thrown when you attempt to create terms documents with a duplicate <code>TermsName</code>.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cognito_identity_provider.types.update_terms_request.UpdateTermsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cognito_identity_provider.types.update_terms_response.UpdateTermsResponse"
    ]:
        import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_terms

        (
            output,
            http_response,
        ) = await capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_terms.async_update_terms(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_cognito_identity_provider.types.update_terms_response.UpdateTermsResponse",
    ) -> dict[str, Any]:
        import capo_cognito_identity_provider.types.update_terms_response

        return capo_cognito_identity_provider.types.update_terms_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateTerms", redact_output=_redact_output),
    )
    input_: capo_cognito_identity_provider.types.update_terms_request.UpdateTermsRequest = {
        "terms_id": terms_id,
        "user_pool_id": user_pool_id,
    }
    if terms_name is not None:
        input_["terms_name"] = terms_name
    if terms_source is not None:
        input_["terms_source"] = terms_source
    if enforcement is not None:
        input_["enforcement"] = enforcement
    if links is not None:
        input_["links"] = links

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