@jaypie/constructs 1.2.66 → 1.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,6 +213,19 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
213
213
  * @default CDK.ROLE.HOSTING
214
214
  */
215
215
  roleTag?: string;
216
+ /**
217
+ * Service tag for attributing this distribution to a service (parallel to
218
+ * `roleTag`, matching `JaypieLambda`). When set, the distribution is tagged
219
+ * with `CDK.TAG.SERVICE` (so metrics carry `service:<value>` instead of
220
+ * `service:N/A`) and the created access-log and WAF-log buckets are tagged
221
+ * with the same value, so the Datadog forwarder attributes their forwarded
222
+ * logs to the service instead of the generic `cloudfront`/source default.
223
+ *
224
+ * Omit to preserve current behavior (no service tag). Has no effect on
225
+ * external/imported log buckets, which this construct does not own.
226
+ * @default undefined (no service tag)
227
+ */
228
+ serviceTag?: string;
216
229
  /**
217
230
  * WAF WebACL configuration for the CloudFront distribution.
218
231
  * - true/undefined: create and attach a WebACL with sensible defaults
package/dist/esm/index.js CHANGED
@@ -2672,7 +2672,7 @@ const DEFAULT_MANAGED_RULES$1 = [
2672
2672
  class JaypieDistribution extends Construct {
2673
2673
  constructor(scope, id, props) {
2674
2674
  super(scope, id);
2675
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), responseHeadersPolicy: responseHeadersPolicyProp, roleTag = CDK$2.ROLE.API, securityHeaders: securityHeadersProp, streaming = false, waf: wafProp = true, zone: propsZone, ...distributionProps } = props;
2675
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), responseHeadersPolicy: responseHeadersPolicyProp, roleTag = CDK$2.ROLE.API, securityHeaders: securityHeadersProp, serviceTag, streaming = false, waf: wafProp = true, zone: propsZone, ...distributionProps } = props;
2676
2676
  // Validate environment variables
2677
2677
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2678
2678
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2881,6 +2881,9 @@ class JaypieDistribution extends Construct {
2881
2881
  removalPolicy: RemovalPolicy.DESTROY,
2882
2882
  });
2883
2883
  Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.STORAGE);
2884
+ if (serviceTag) {
2885
+ Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
2886
+ }
2884
2887
  logBucket = createdBucket;
2885
2888
  }
2886
2889
  // Add S3 notifications if we have a bucket and destination is not false
@@ -2911,6 +2914,9 @@ class JaypieDistribution extends Construct {
2911
2914
  ...distributionProps,
2912
2915
  });
2913
2916
  Tags.of(this.distribution).add(CDK$2.TAG.ROLE, roleTag);
2917
+ if (serviceTag) {
2918
+ Tags.of(this.distribution).add(CDK$2.TAG.SERVICE, serviceTag);
2919
+ }
2914
2920
  this.distributionArn = `arn:aws:cloudfront::${Stack.of(this).account}:distribution/${this.distribution.distributionId}`;
2915
2921
  this.distributionDomainName = this.distribution.distributionDomainName;
2916
2922
  this.distributionId = this.distribution.distributionId;
@@ -3115,6 +3121,9 @@ class JaypieDistribution extends Construct {
3115
3121
  removalPolicy: RemovalPolicy.RETAIN,
3116
3122
  });
3117
3123
  Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
3124
+ if (serviceTag) {
3125
+ Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
3126
+ }
3118
3127
  // Add Datadog forwarder notification
3119
3128
  if (destinationProp !== false) {
3120
3129
  const lambdaDestination = destinationProp === true