Skip to content
v2.273.0

ClientAttributes Class ​

A set of attributes, useful to set Read and Write attributes.

Example ​

ts
const pool = new cognito.UserPool(this, 'Pool');

const clientWriteAttributes = (new cognito.ClientAttributes())
  .withStandardAttributes({fullname: true, email: true})
  .withCustomAttributes('favoritePizza', 'favoriteBeverage');

const clientReadAttributes = clientWriteAttributes
  .withStandardAttributes({emailVerified: true})
  .withCustomAttributes('pointsEarned');

pool.addClient('app-client', {
  // ...
  readAttributes: clientReadAttributes,
  writeAttributes: clientWriteAttributes,
});
python
pool = cognito.UserPool(self, "Pool")

client_write_attributes = (cognito.ClientAttributes()).with_standard_attributes(fullname=True, email=True).with_custom_attributes("favoritePizza", "favoriteBeverage")

client_read_attributes = client_write_attributes.with_standard_attributes(email_verified=True).with_custom_attributes("pointsEarned")

pool.add_client("app-client",
    # ...
    read_attributes=client_read_attributes,
    write_attributes=client_write_attributes
)
java
UserPool pool = new UserPool(this, "Pool");

ClientAttributes clientWriteAttributes = (new ClientAttributes()).withStandardAttributes(StandardAttributesMask.builder().fullname(true).email(true).build()).withCustomAttributes("favoritePizza", "favoriteBeverage");

ClientAttributes clientReadAttributes = clientWriteAttributes.withStandardAttributes(StandardAttributesMask.builder().emailVerified(true).build()).withCustomAttributes("pointsEarned");

pool.addClient("app-client", UserPoolClientOptions.builder()
        // ...
        .readAttributes(clientReadAttributes)
        .writeAttributes(clientWriteAttributes)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var pool = new UserPool(this, "Pool");

var clientWriteAttributes = (new ClientAttributes()).WithStandardAttributes(new StandardAttributesMask { Fullname = true, Email = true }).WithCustomAttributes("favoritePizza", "favoriteBeverage");

var clientReadAttributes = clientWriteAttributes.WithStandardAttributes(new StandardAttributesMask { EmailVerified = true }).WithCustomAttributes("pointsEarned");

pool.AddClient("app-client", new UserPoolClientOptions {
    // ...
    ReadAttributes = clientReadAttributes,
    WriteAttributes = clientWriteAttributes
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
pool := cognito.NewUserPool(this, jsii.String("Pool"))

clientWriteAttributes := (cognito.NewClientAttributes()).WithStandardAttributes(&StandardAttributesMask{
	Fullname: jsii.Boolean(true),
	Email: jsii.Boolean(true),
}).WithCustomAttributes(jsii.String("favoritePizza"), jsii.String("favoriteBeverage"))

clientReadAttributes := clientWriteAttributes.WithStandardAttributes(&StandardAttributesMask{
	EmailVerified: jsii.Boolean(true),
}).WithCustomAttributes(jsii.String("pointsEarned"))

pool.addClient(jsii.String("app-client"), &UserPoolClientOptions{
	// ...
	ReadAttributes: clientReadAttributes,
	WriteAttributes: clientWriteAttributes,
})

Initializer ​

ts
new ClientAttributes()
python
ClientAttributes()
java
new ClientAttributes()
csharp
new ClientAttributes()
go
NewClientAttributes()

Methods ​

attributes(): string[]def attributes(self, ) -> typing.List[str]public List<String> attributes()public string[] Attributes()func Attributes() *[]*string#
The list of attributes represented by this ClientAttributes.
withCustomAttributes(...attributes: string[]): ClientAttributes // chainabledef with_custom_attributes(self, attributes: str) -> ClientAttributespublic ClientAttributes withCustomAttributes(String attributes)public ClientAttributes WithCustomAttributes(string attributes)func WithCustomAttributes(Attributes *string) ClientAttributes#
Creates a custom ClientAttributes with the specified attributes.
1 parameter

Parameters

  • attributesattributesattributesattributesAttributes — a list of custom attributes to add to the set.
withStandardAttributes(attributes: StandardAttributesMask): ClientAttributes // chainabledef with_standard_attributes(self, attributes: StandardAttributesMask) -> ClientAttributespublic ClientAttributes withStandardAttributes(StandardAttributesMask attributes)public ClientAttributes WithStandardAttributes(StandardAttributesMask attributes)func WithStandardAttributes(Attributes StandardAttributesMask) ClientAttributes#
Creates a custom ClientAttributes with the specified attributes.
1 parameter

Parameters

  • attributesattributesattributesattributesAttributes — a list of standard attributes to add to the set.