AWSCognitoIdentityProvider; Код состояния: 400; Код ошибки: InvalidParameterException: Cognito Invalid AttributeDataType

Мне нравится создавать пул пользователей когнитивных систем с помощью AWS-CDK версии 0.24.1 на основе Java. В течение cdk deploy я получаю ошибку InvalidParameterException.

Служба: AWSCognitoIdentityProvider;
Код состояния: 400;
Код ошибки: InvalidParameterException: Cognito Invalid AttributeDataType input, рассмотрите возможность использования предоставленного Перечисление AttributeDataType

    CfnUserPool userPool = new CfnUserPool(this, "cognito",
    CfnUserPoolProps.builder()
        .withAdminCreateUserConfig(
            AdminCreateUserConfigProperty.builder()
                .withAllowAdminCreateUserOnly(false)
                .build())
        .withPolicies(
            PoliciesProperty.builder()
                .withPasswordPolicy(
                    PasswordPolicyProperty.builder()
                        .withMinimumLength(6)
                        .withRequireLowercase(false)
                        .withRequireNumbers(false)
                        .withRequireSymbols(false)
                        .withRequireUppercase(false)
                        .build()
                )
                .build()
        )
        .withAutoVerifiedAttributes(Arrays.asList("email"))
        .withSchema(Arrays.asList("email"))
    .build());

Возможно, простой список строк .withAutoVerifiedAttributes(Arrays.asList("email")) или .withSchema(Arrays.asList("email")) неверен. Но, к сожалению, есть только список объектов, объявленных в сигнатуре метода, а не конкретный тип: public CfnUserPoolProps.Builder withAutoVerifiedAttributes(@Nullable List value).

Есть ли пример фрагмента для создания аналогичного пользовательского пула с использованием aws-cdk на основе Java.


person Sma Ma    schedule 02.03.2019    source источник


Ответы (1)


использование CfnUserPool.SchemaAttributeProperty.builder() решило проблему. Я думаю, SchemaAttributeProperty - это ожидаемый тип данных метода withSchema(@Nullable List< Object > value)

CfnUserPool userPool = new CfnUserPool(this, "cognito",
    CfnUserPoolProps.builder()
        .withAdminCreateUserConfig(
            AdminCreateUserConfigProperty.builder()
                .withAllowAdminCreateUserOnly(false)
                .build())
        .withPolicies(
            PoliciesProperty.builder()
                .withPasswordPolicy(
                    PasswordPolicyProperty.builder()
                        .withMinimumLength(6)
                        .withRequireLowercase(false)
                        .withRequireNumbers(false)
                        .withRequireSymbols(false)
                        .withRequireUppercase(false)
                        .build()
                )
                .build()
        )
       .withAutoVerifiedAttributes(Arrays.asList("email"))
       .withSchema(Arrays.asList(
           CfnUserPool.SchemaAttributeProperty.builder()
               .withAttributeDataType("String")
               .withName("email")
               .withRequired(true)
           .build()))
    .build());
person Sma Ma    schedule 02.03.2019