Creates 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:
-
user_pool_id
(UserPoolIdType)
–
The ID of the user pool where you want to create terms documents.
-
client_id
(ClientIdType)
–
The ID of the app client where you want to create terms documents. Must be an app client in the requested user pool.
-
terms_name
(TermsNameType)
–
A friendly name for the document that you want to create in the current request. Must begin with terms-of-use or privacy-policy as identification of the document type. Provide URLs for both terms-of-use and privacy-policy in separate requests.
-
terms_source
(TermsSourceType)
–
This parameter is reserved for future use and currently accepts only one value.
-
enforcement
(TermsEnforcementType)
–
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.
-
LimitExceededException
–
This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.
-
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/cognito_identity_provider.py
| def create_terms(
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",
terms_name: "capo_cognito_identity_provider.types.terms_name_type.TermsNameType",
terms_source: "capo_cognito_identity_provider.types.terms_source_type.TermsSourceType",
enforcement: "capo_cognito_identity_provider.types.terms_enforcement_type.TermsEnforcementType",
*,
config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
links: Optional[
"capo_cognito_identity_provider.types.links_type.LinksType"
] = None,
) -> (
"capo_cognito_identity_provider.types.create_terms_response.CreateTermsResponse"
):
"""<p>Creates 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:
user_pool_id: <p>The ID of the user pool where you want to create terms documents.</p>
client_id: <p>The ID of the app client where you want to create terms documents. Must be an app client in the requested user pool.</p>
terms_name: <p>A friendly name for the document that you want to create in the current request. Must begin with <code>terms-of-use</code> or <code>privacy-policy</code> as identification of the document type. Provide URLs for both <code>terms-of-use</code> and <code>privacy-policy</code> in separate requests.</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.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.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.
"""
def _handler(
req: "OperationRequest[capo_cognito_identity_provider.types.create_terms_request.CreateTermsRequest]",
) -> OperationResponse[
"capo_cognito_identity_provider.types.create_terms_response.CreateTermsResponse"
]:
import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.create_terms
output, http_response = (
capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.create_terms.create_terms(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_cognito_identity_provider.types.create_terms_request.CreateTermsRequest",
) -> dict[str, Any]:
import capo_cognito_identity_provider.types.create_terms_request
return capo_cognito_identity_provider.types.create_terms_request.redact_sensitive(
input_
)
def _redact_output(
output: "capo_cognito_identity_provider.types.create_terms_response.CreateTermsResponse",
) -> dict[str, Any]:
import capo_cognito_identity_provider.types.create_terms_response
return capo_cognito_identity_provider.types.create_terms_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"CreateTerms", redact_input=_redact_input, redact_output=_redact_output
),
)
input_: capo_cognito_identity_provider.types.create_terms_request.CreateTermsRequest = {
"user_pool_id": user_pool_id,
"client_id": client_id,
"terms_name": terms_name,
"terms_source": terms_source,
"enforcement": enforcement,
}
if links is not None:
input_["links"] = links
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|