@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
@@ -2708,7 +2708,7 @@ const DEFAULT_MANAGED_RULES$1 = [
2708
2708
  class JaypieDistribution extends constructs.Construct {
2709
2709
  constructor(scope, id, props) {
2710
2710
  super(scope, id);
2711
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = cdk.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;
2711
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = cdk.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;
2712
2712
  // Validate environment variables
2713
2713
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2714
2714
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2917,6 +2917,9 @@ class JaypieDistribution extends constructs.Construct {
2917
2917
  removalPolicy: cdk.RemovalPolicy.DESTROY,
2918
2918
  });
2919
2919
  cdk.Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.STORAGE);
2920
+ if (serviceTag) {
2921
+ cdk.Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
2922
+ }
2920
2923
  logBucket = createdBucket;
2921
2924
  }
2922
2925
  // Add S3 notifications if we have a bucket and destination is not false
@@ -2947,6 +2950,9 @@ class JaypieDistribution extends constructs.Construct {
2947
2950
  ...distributionProps,
2948
2951
  });
2949
2952
  cdk.Tags.of(this.distribution).add(CDK$2.TAG.ROLE, roleTag);
2953
+ if (serviceTag) {
2954
+ cdk.Tags.of(this.distribution).add(CDK$2.TAG.SERVICE, serviceTag);
2955
+ }
2950
2956
  this.distributionArn = `arn:aws:cloudfront::${cdk.Stack.of(this).account}:distribution/${this.distribution.distributionId}`;
2951
2957
  this.distributionDomainName = this.distribution.distributionDomainName;
2952
2958
  this.distributionId = this.distribution.distributionId;
@@ -3151,6 +3157,9 @@ class JaypieDistribution extends constructs.Construct {
3151
3157
  removalPolicy: cdk.RemovalPolicy.RETAIN,
3152
3158
  });
3153
3159
  cdk.Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
3160
+ if (serviceTag) {
3161
+ cdk.Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
3162
+ }
3154
3163
  // Add Datadog forwarder notification
3155
3164
  if (destinationProp !== false) {
3156
3165
  const lambdaDestination = destinationProp === true