Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iot-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ new iot.AccountAuditConfiguration(this, 'AuditConfiguration', {
checkConfiguration: {
deviceCertificateAgeCheck: true,
// The default value is 365 days
// Valid values range from 30 days (minimum) to 3652 days (10 years, maximum)
// Valid values range from 30 days (minimum) to 3650 days (10 years, maximum)
deviceCertificateAgeCheckDuration: Duration.days(365),
},
});
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-iot-alpha/lib/audit-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface CheckConfiguration {
* The duration used to check if a device certificate has been active
* for a number of days greater than or equal to the number you specify.
*
* Valid values range from 30 days (minimum) to 3652 days (10 years, maximum).
* Valid values range from 30 days (minimum) to 3650 days (10 years, maximum).
*
* You cannot specify a value for this check if `deviceCertificateAgeCheck` is set to `false`.
*
Expand Down Expand Up @@ -231,8 +231,8 @@ export class AccountAuditConfiguration extends Resource implements IAccountAudit
if (props?.checkConfiguration?.deviceCertificateAgeCheck === false) {
throw new Error('You cannot specify a value for `deviceCertificateAgeCheckDuration` if `deviceCertificateAgeCheck` is set to `false`.');
}
if (!deviceAgeCheckThreshold.isUnresolved() && deviceAgeCheckThreshold.toDays() < 30 || deviceAgeCheckThreshold.toDays() > 3652) {
throw new Error(`The device certificate age check threshold must be between 30 and 3652 days. got: ${deviceAgeCheckThreshold.toDays()} days.`);
if (!deviceAgeCheckThreshold.isUnresolved() && deviceAgeCheckThreshold.toDays() < 30 || deviceAgeCheckThreshold.toDays() > 3650) {
throw new Error(`The device certificate age check threshold must be between 30 and 3650 days. got: ${deviceAgeCheckThreshold.toDays()} days.`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ test('throw error for configuring duration without enabling deviceCertificateAge

test.each([
cdk.Duration.days(29),
cdk.Duration.days(3653),
cdk.Duration.days(3651),
])('throw error for invalid duration %s', (duration) => {
const stack = new cdk.Stack();
expect(() => new iot.AccountAuditConfiguration(stack, 'AccountAuditConfiguration', {
checkConfiguration: {
deviceCertificateAgeCheck: true,
deviceCertificateAgeCheckDuration: duration,
},
})).toThrow(`The device certificate age check threshold must be between 30 and 3652 days. got: ${duration.toDays()} days.`);
})).toThrow(`The device certificate age check threshold must be between 30 and 3650 days. got: ${duration.toDays()} days.`);
});

test('import by Account ID', () => {
Expand Down
Loading