Skip to content

Commit c70378d

Browse files
author
awstools
committed
feat(client-cloudfront): CloudFront now supports the Server-Timing header in HTTP responses sent from CloudFront. You can use this header to view metrics that help you gain insights about the behavior and performance of CloudFront. To use this header, enable it in a response headers policy.
1 parent 85a8b9d commit c70378d

File tree

5 files changed

+197
-18
lines changed

5 files changed

+197
-18
lines changed

clients/client-cloudfront/src/commands/DeleteMonitoringSubscriptionCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {
1212
} from "@aws-sdk/types";
1313

1414
import { CloudFrontClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFrontClient";
15-
import { DeleteMonitoringSubscriptionRequest } from "../models/models_0";
16-
import { DeleteMonitoringSubscriptionResult } from "../models/models_1";
15+
import { DeleteMonitoringSubscriptionRequest, DeleteMonitoringSubscriptionResult } from "../models/models_1";
1716
import {
1817
deserializeAws_restXmlDeleteMonitoringSubscriptionCommand,
1918
serializeAws_restXmlDeleteMonitoringSubscriptionCommand,

clients/client-cloudfront/src/models/models_0.ts

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7855,6 +7855,47 @@ export namespace ResponseHeadersPolicySecurityHeadersConfig {
78557855
});
78567856
}
78577857

7858+
/**
7859+
* <p>A configuration for enabling the <code>Server-Timing</code> header in HTTP responses sent
7860+
* from CloudFront. CloudFront adds this header to HTTP responses that it sends in response to requests
7861+
* that match a cache behavior that's associated with this response headers policy.</p>
7862+
* <p>You can use the <code>Server-Timing</code> header to view metrics that can help you gain
7863+
* insights about the behavior and performance of CloudFront. For example, you can see which
7864+
* cache layer served a cache hit, or the first byte latency from the origin when there was
7865+
* a cache miss. You can use the metrics in the <code>Server-Timing</code> header to
7866+
* troubleshoot issues or test the efficiency of your CloudFront configuration. For more
7867+
* information, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/understanding-response-headers-policies.html#server-timing-header">Server-Timing header</a> in the
7868+
* <i>Amazon CloudFront Developer Guide</i>.</p>
7869+
*/
7870+
export interface ResponseHeadersPolicyServerTimingHeadersConfig {
7871+
/**
7872+
* <p>A Boolean that determines whether CloudFront adds the <code>Server-Timing</code> header to HTTP
7873+
* responses that it sends in response to requests that match a cache behavior that's
7874+
* associated with this response headers policy.</p>
7875+
*/
7876+
Enabled: boolean | undefined;
7877+
7878+
/**
7879+
* <p>A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to
7880+
* add the <code>Server-Timing</code> header to. When you set the sampling rate to 100,
7881+
* CloudFront adds the <code>Server-Timing</code> header to the HTTP response for every request
7882+
* that matches the cache behavior that this response headers policy is attached to. When
7883+
* you set it to 50, CloudFront adds the header to 50% of the responses for requests that match
7884+
* the cache behavior. You can set the sampling rate to any number 0–100 with up to four
7885+
* decimal places.</p>
7886+
*/
7887+
SamplingRate?: number;
7888+
}
7889+
7890+
export namespace ResponseHeadersPolicyServerTimingHeadersConfig {
7891+
/**
7892+
* @internal
7893+
*/
7894+
export const filterSensitiveLog = (obj: ResponseHeadersPolicyServerTimingHeadersConfig): any => ({
7895+
...obj,
7896+
});
7897+
}
7898+
78587899
/**
78597900
* <p>A response headers policy configuration.</p>
78607901
* <p>A response headers policy configuration contains metadata about the response headers policy,
@@ -7890,6 +7931,12 @@ export interface ResponseHeadersPolicyConfig {
78907931
* <p>A configuration for a set of custom HTTP response headers.</p>
78917932
*/
78927933
CustomHeadersConfig?: ResponseHeadersPolicyCustomHeadersConfig;
7934+
7935+
/**
7936+
* <p>A configuration for enabling the <code>Server-Timing</code> header in HTTP responses
7937+
* sent from CloudFront.</p>
7938+
*/
7939+
ServerTimingHeadersConfig?: ResponseHeadersPolicyServerTimingHeadersConfig;
78937940
}
78947941

78957942
export namespace ResponseHeadersPolicyConfig {
@@ -8909,19 +8956,3 @@ export class ResourceInUse extends __BaseException {
89098956
this.Message = opts.Message;
89108957
}
89118958
}
8912-
8913-
export interface DeleteMonitoringSubscriptionRequest {
8914-
/**
8915-
* <p>The ID of the distribution that you are disabling metrics for.</p>
8916-
*/
8917-
DistributionId: string | undefined;
8918-
}
8919-
8920-
export namespace DeleteMonitoringSubscriptionRequest {
8921-
/**
8922-
* @internal
8923-
*/
8924-
export const filterSensitiveLog = (obj: DeleteMonitoringSubscriptionRequest): any => ({
8925-
...obj,
8926-
});
8927-
}

clients/client-cloudfront/src/models/models_1.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ import {
5151
ViewerCertificate,
5252
} from "./models_0";
5353

54+
export interface DeleteMonitoringSubscriptionRequest {
55+
/**
56+
* <p>The ID of the distribution that you are disabling metrics for.</p>
57+
*/
58+
DistributionId: string | undefined;
59+
}
60+
61+
export namespace DeleteMonitoringSubscriptionRequest {
62+
/**
63+
* @internal
64+
*/
65+
export const filterSensitiveLog = (obj: DeleteMonitoringSubscriptionRequest): any => ({
66+
...obj,
67+
});
68+
}
69+
5470
export interface DeleteMonitoringSubscriptionResult {}
5571

5672
export namespace DeleteMonitoringSubscriptionResult {

clients/client-cloudfront/src/protocols/Aws_restXml.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getValueFromTextNode as __getValueFromTextNode,
1010
parseBoolean as __parseBoolean,
1111
parseRfc3339DateTime as __parseRfc3339DateTime,
12+
strictParseFloat as __strictParseFloat,
1213
strictParseInt32 as __strictParseInt32,
1314
strictParseLong as __strictParseLong,
1415
} from "@aws-sdk/smithy-client";
@@ -450,6 +451,7 @@ import {
450451
ResponseHeadersPolicyFrameOptions,
451452
ResponseHeadersPolicyReferrerPolicy,
452453
ResponseHeadersPolicySecurityHeadersConfig,
454+
ResponseHeadersPolicyServerTimingHeadersConfig,
453455
ResponseHeadersPolicyStrictTransportSecurity,
454456
ResponseHeadersPolicyXSSProtection,
455457
Restrictions,
@@ -13041,6 +13043,13 @@ const serializeAws_restXmlResponseHeadersPolicyConfig = (
1304113043
).withName("CustomHeadersConfig");
1304213044
bodyNode.addChildNode(node);
1304313045
}
13046+
if (input.ServerTimingHeadersConfig !== undefined && input.ServerTimingHeadersConfig !== null) {
13047+
const node = serializeAws_restXmlResponseHeadersPolicyServerTimingHeadersConfig(
13048+
input.ServerTimingHeadersConfig,
13049+
context
13050+
).withName("ServerTimingHeadersConfig");
13051+
bodyNode.addChildNode(node);
13052+
}
1304413053
return bodyNode;
1304513054
};
1304613055

@@ -13266,6 +13275,24 @@ const serializeAws_restXmlResponseHeadersPolicySecurityHeadersConfig = (
1326613275
return bodyNode;
1326713276
};
1326813277

13278+
const serializeAws_restXmlResponseHeadersPolicyServerTimingHeadersConfig = (
13279+
input: ResponseHeadersPolicyServerTimingHeadersConfig,
13280+
context: __SerdeContext
13281+
): any => {
13282+
const bodyNode = new __XmlNode("ResponseHeadersPolicyServerTimingHeadersConfig");
13283+
if (input.Enabled !== undefined && input.Enabled !== null) {
13284+
const node = new __XmlNode("boolean").addChildNode(new __XmlText(String(input.Enabled))).withName("Enabled");
13285+
bodyNode.addChildNode(node);
13286+
}
13287+
if (input.SamplingRate !== undefined && input.SamplingRate !== null) {
13288+
const node = new __XmlNode("SamplingRate")
13289+
.addChildNode(new __XmlText(String(input.SamplingRate)))
13290+
.withName("SamplingRate");
13291+
bodyNode.addChildNode(node);
13292+
}
13293+
return bodyNode;
13294+
};
13295+
1326913296
const serializeAws_restXmlResponseHeadersPolicyStrictTransportSecurity = (
1327013297
input: ResponseHeadersPolicyStrictTransportSecurity,
1327113298
context: __SerdeContext
@@ -16753,6 +16780,7 @@ const deserializeAws_restXmlResponseHeadersPolicyConfig = (
1675316780
CorsConfig: undefined,
1675416781
SecurityHeadersConfig: undefined,
1675516782
CustomHeadersConfig: undefined,
16783+
ServerTimingHeadersConfig: undefined,
1675616784
};
1675716785
if (output["Comment"] !== undefined) {
1675816786
contents.Comment = __expectString(output["Comment"]);
@@ -16775,6 +16803,12 @@ const deserializeAws_restXmlResponseHeadersPolicyConfig = (
1677516803
context
1677616804
);
1677716805
}
16806+
if (output["ServerTimingHeadersConfig"] !== undefined) {
16807+
contents.ServerTimingHeadersConfig = deserializeAws_restXmlResponseHeadersPolicyServerTimingHeadersConfig(
16808+
output["ServerTimingHeadersConfig"],
16809+
context
16810+
);
16811+
}
1677816812
return contents;
1677916813
};
1678016814

@@ -17025,6 +17059,23 @@ const deserializeAws_restXmlResponseHeadersPolicySecurityHeadersConfig = (
1702517059
return contents;
1702617060
};
1702717061

17062+
const deserializeAws_restXmlResponseHeadersPolicyServerTimingHeadersConfig = (
17063+
output: any,
17064+
context: __SerdeContext
17065+
): ResponseHeadersPolicyServerTimingHeadersConfig => {
17066+
const contents: any = {
17067+
Enabled: undefined,
17068+
SamplingRate: undefined,
17069+
};
17070+
if (output["Enabled"] !== undefined) {
17071+
contents.Enabled = __parseBoolean(output["Enabled"]);
17072+
}
17073+
if (output["SamplingRate"] !== undefined) {
17074+
contents.SamplingRate = __strictParseFloat(output["SamplingRate"]) as number;
17075+
}
17076+
return contents;
17077+
};
17078+
1702817079
const deserializeAws_restXmlResponseHeadersPolicyStrictTransportSecurity = (
1702917080
output: any,
1703017081
context: __SerdeContext

0 commit comments

Comments
 (0)