-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathcertificate-base.ts
32 lines (29 loc) · 1.04 KB
/
certificate-base.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import { Statistic } from '@aws-cdk/aws-cloudwatch';
import { Duration, Resource } from '@aws-cdk/core';
import { ICertificate } from './certificate';
/**
* Shared implementation details of ICertificate implementations.
*
* @internal
*/
export abstract class CertificateBase extends Resource implements ICertificate {
public abstract readonly certificateArn: string;
/**
* If the certificate is provisionned in a different region than the
* containing stack, this should be the region in which the certificate lives
* so we can correctly create `Metric` instances.
*/
protected readonly region?: string;
public metricDaysToExpiry(props?: cloudwatch.MetricOptions): cloudwatch.Metric {
return new cloudwatch.Metric({
period: Duration.days(1),
...props,
dimensionsMap: { CertificateArn: this.certificateArn },
metricName: 'DaysToExpiry',
namespace: 'AWS/CertificateManager',
region: this.region,
statistic: Statistic.MINIMUM,
});
}
}