Skip to content

Commit eedf577

Browse files
Strict date parsing regeneration (#2760)
* feat(codegen): strictly parse timestamps Uses strict parsing methods to deserialize timestamp values. Enables timestamp malformed request tests in the SSDK as well. * chore(codegen): regenerate clients and protocol tests Regenerates to use strict timestamp parsing
1 parent 6e8ddd7 commit eedf577

File tree

223 files changed

+4720
-3363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+4720
-3363
lines changed

clients/client-accessanalyzer/protocols/Aws_restJson1.ts

+84-22
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import {
117117
expectObject as __expectObject,
118118
expectString as __expectString,
119119
extendedEncodeURIComponent as __extendedEncodeURIComponent,
120+
parseRfc3339DateTime as __parseRfc3339DateTime,
120121
strictParseInt32 as __strictParseInt32,
121122
} from "@aws-sdk/smithy-client";
122123
import {
@@ -4023,7 +4024,10 @@ const deserializeAws_restJson1AccessPreview = (output: any, context: __SerdeCont
40234024
output.configurations !== undefined && output.configurations !== null
40244025
? deserializeAws_restJson1ConfigurationsMap(output.configurations, context)
40254026
: undefined,
4026-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4027+
createdAt:
4028+
output.createdAt !== undefined && output.createdAt !== null
4029+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4030+
: undefined,
40274031
id: __expectString(output.id),
40284032
status: __expectString(output.status),
40294033
statusReason:
@@ -4044,7 +4048,10 @@ const deserializeAws_restJson1AccessPreviewFinding = (output: any, context: __Se
40444048
output.condition !== undefined && output.condition !== null
40454049
? deserializeAws_restJson1ConditionKeyMap(output.condition, context)
40464050
: undefined,
4047-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4051+
createdAt:
4052+
output.createdAt !== undefined && output.createdAt !== null
4053+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4054+
: undefined,
40484055
error: __expectString(output.error),
40494056
existingFindingId: __expectString(output.existingFindingId),
40504057
existingFindingStatus: __expectString(output.existingFindingStatus),
@@ -4102,7 +4109,10 @@ const deserializeAws_restJson1AccessPreviewStatusReason = (
41024109
const deserializeAws_restJson1AccessPreviewSummary = (output: any, context: __SerdeContext): AccessPreviewSummary => {
41034110
return {
41044111
analyzerArn: __expectString(output.analyzerArn),
4105-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4112+
createdAt:
4113+
output.createdAt !== undefined && output.createdAt !== null
4114+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4115+
: undefined,
41064116
id: __expectString(output.id),
41074117
status: __expectString(output.status),
41084118
statusReason:
@@ -4139,8 +4149,14 @@ const deserializeAws_restJson1AnalyzedResource = (output: any, context: __SerdeC
41394149
output.actions !== undefined && output.actions !== null
41404150
? deserializeAws_restJson1ActionList(output.actions, context)
41414151
: undefined,
4142-
analyzedAt: output.analyzedAt !== undefined && output.analyzedAt !== null ? new Date(output.analyzedAt) : undefined,
4143-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4152+
analyzedAt:
4153+
output.analyzedAt !== undefined && output.analyzedAt !== null
4154+
? __expectNonNull(__parseRfc3339DateTime(output.analyzedAt))
4155+
: undefined,
4156+
createdAt:
4157+
output.createdAt !== undefined && output.createdAt !== null
4158+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4159+
: undefined,
41444160
error: __expectString(output.error),
41454161
isPublic: __expectBoolean(output.isPublic),
41464162
resourceArn: __expectString(output.resourceArn),
@@ -4151,7 +4167,10 @@ const deserializeAws_restJson1AnalyzedResource = (output: any, context: __SerdeC
41514167
? deserializeAws_restJson1SharedViaList(output.sharedVia, context)
41524168
: undefined,
41534169
status: __expectString(output.status),
4154-
updatedAt: output.updatedAt !== undefined && output.updatedAt !== null ? new Date(output.updatedAt) : undefined,
4170+
updatedAt:
4171+
output.updatedAt !== undefined && output.updatedAt !== null
4172+
? __expectNonNull(__parseRfc3339DateTime(output.updatedAt))
4173+
: undefined,
41554174
} as any;
41564175
};
41574176

@@ -4194,11 +4213,14 @@ const deserializeAws_restJson1AnalyzersList = (output: any, context: __SerdeCont
41944213
const deserializeAws_restJson1AnalyzerSummary = (output: any, context: __SerdeContext): AnalyzerSummary => {
41954214
return {
41964215
arn: __expectString(output.arn),
4197-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4216+
createdAt:
4217+
output.createdAt !== undefined && output.createdAt !== null
4218+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4219+
: undefined,
41984220
lastResourceAnalyzed: __expectString(output.lastResourceAnalyzed),
41994221
lastResourceAnalyzedAt:
42004222
output.lastResourceAnalyzedAt !== undefined && output.lastResourceAnalyzedAt !== null
4201-
? new Date(output.lastResourceAnalyzedAt)
4223+
? __expectNonNull(__parseRfc3339DateTime(output.lastResourceAnalyzedAt))
42024224
: undefined,
42034225
name: __expectString(output.name),
42044226
status: __expectString(output.status),
@@ -4227,20 +4249,32 @@ const deserializeAws_restJson1ArchiveRulesList = (output: any, context: __SerdeC
42274249

42284250
const deserializeAws_restJson1ArchiveRuleSummary = (output: any, context: __SerdeContext): ArchiveRuleSummary => {
42294251
return {
4230-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4252+
createdAt:
4253+
output.createdAt !== undefined && output.createdAt !== null
4254+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4255+
: undefined,
42314256
filter:
42324257
output.filter !== undefined && output.filter !== null
42334258
? deserializeAws_restJson1FilterCriteriaMap(output.filter, context)
42344259
: undefined,
42354260
ruleName: __expectString(output.ruleName),
4236-
updatedAt: output.updatedAt !== undefined && output.updatedAt !== null ? new Date(output.updatedAt) : undefined,
4261+
updatedAt:
4262+
output.updatedAt !== undefined && output.updatedAt !== null
4263+
? __expectNonNull(__parseRfc3339DateTime(output.updatedAt))
4264+
: undefined,
42374265
} as any;
42384266
};
42394267

42404268
const deserializeAws_restJson1CloudTrailProperties = (output: any, context: __SerdeContext): CloudTrailProperties => {
42414269
return {
4242-
endTime: output.endTime !== undefined && output.endTime !== null ? new Date(output.endTime) : undefined,
4243-
startTime: output.startTime !== undefined && output.startTime !== null ? new Date(output.startTime) : undefined,
4270+
endTime:
4271+
output.endTime !== undefined && output.endTime !== null
4272+
? __expectNonNull(__parseRfc3339DateTime(output.endTime))
4273+
: undefined,
4274+
startTime:
4275+
output.startTime !== undefined && output.startTime !== null
4276+
? __expectNonNull(__parseRfc3339DateTime(output.startTime))
4277+
: undefined,
42444278
trailProperties:
42454279
output.trailProperties !== undefined && output.trailProperties !== null
42464280
? deserializeAws_restJson1TrailPropertiesList(output.trailProperties, context)
@@ -4344,12 +4378,18 @@ const deserializeAws_restJson1Finding = (output: any, context: __SerdeContext):
43444378
output.action !== undefined && output.action !== null
43454379
? deserializeAws_restJson1ActionList(output.action, context)
43464380
: undefined,
4347-
analyzedAt: output.analyzedAt !== undefined && output.analyzedAt !== null ? new Date(output.analyzedAt) : undefined,
4381+
analyzedAt:
4382+
output.analyzedAt !== undefined && output.analyzedAt !== null
4383+
? __expectNonNull(__parseRfc3339DateTime(output.analyzedAt))
4384+
: undefined,
43484385
condition:
43494386
output.condition !== undefined && output.condition !== null
43504387
? deserializeAws_restJson1ConditionKeyMap(output.condition, context)
43514388
: undefined,
4352-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4389+
createdAt:
4390+
output.createdAt !== undefined && output.createdAt !== null
4391+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4392+
: undefined,
43534393
error: __expectString(output.error),
43544394
id: __expectString(output.id),
43554395
isPublic: __expectBoolean(output.isPublic),
@@ -4365,7 +4405,10 @@ const deserializeAws_restJson1Finding = (output: any, context: __SerdeContext):
43654405
? deserializeAws_restJson1FindingSourceList(output.sources, context)
43664406
: undefined,
43674407
status: __expectString(output.status),
4368-
updatedAt: output.updatedAt !== undefined && output.updatedAt !== null ? new Date(output.updatedAt) : undefined,
4408+
updatedAt:
4409+
output.updatedAt !== undefined && output.updatedAt !== null
4410+
? __expectNonNull(__parseRfc3339DateTime(output.updatedAt))
4411+
: undefined,
43694412
} as any;
43704413
};
43714414

@@ -4413,12 +4456,18 @@ const deserializeAws_restJson1FindingSummary = (output: any, context: __SerdeCon
44134456
output.action !== undefined && output.action !== null
44144457
? deserializeAws_restJson1ActionList(output.action, context)
44154458
: undefined,
4416-
analyzedAt: output.analyzedAt !== undefined && output.analyzedAt !== null ? new Date(output.analyzedAt) : undefined,
4459+
analyzedAt:
4460+
output.analyzedAt !== undefined && output.analyzedAt !== null
4461+
? __expectNonNull(__parseRfc3339DateTime(output.analyzedAt))
4462+
: undefined,
44174463
condition:
44184464
output.condition !== undefined && output.condition !== null
44194465
? deserializeAws_restJson1ConditionKeyMap(output.condition, context)
44204466
: undefined,
4421-
createdAt: output.createdAt !== undefined && output.createdAt !== null ? new Date(output.createdAt) : undefined,
4467+
createdAt:
4468+
output.createdAt !== undefined && output.createdAt !== null
4469+
? __expectNonNull(__parseRfc3339DateTime(output.createdAt))
4470+
: undefined,
44224471
error: __expectString(output.error),
44234472
id: __expectString(output.id),
44244473
isPublic: __expectBoolean(output.isPublic),
@@ -4434,7 +4483,10 @@ const deserializeAws_restJson1FindingSummary = (output: any, context: __SerdeCon
44344483
? deserializeAws_restJson1FindingSourceList(output.sources, context)
44354484
: undefined,
44364485
status: __expectString(output.status),
4437-
updatedAt: output.updatedAt !== undefined && output.updatedAt !== null ? new Date(output.updatedAt) : undefined,
4486+
updatedAt:
4487+
output.updatedAt !== undefined && output.updatedAt !== null
4488+
? __expectNonNull(__parseRfc3339DateTime(output.updatedAt))
4489+
: undefined,
44384490
} as any;
44394491
};
44404492

@@ -4495,13 +4547,18 @@ const deserializeAws_restJson1InternetConfiguration = (output: any, context: __S
44954547
const deserializeAws_restJson1JobDetails = (output: any, context: __SerdeContext): JobDetails => {
44964548
return {
44974549
completedOn:
4498-
output.completedOn !== undefined && output.completedOn !== null ? new Date(output.completedOn) : undefined,
4550+
output.completedOn !== undefined && output.completedOn !== null
4551+
? __expectNonNull(__parseRfc3339DateTime(output.completedOn))
4552+
: undefined,
44994553
jobError:
45004554
output.jobError !== undefined && output.jobError !== null
45014555
? deserializeAws_restJson1JobError(output.jobError, context)
45024556
: undefined,
45034557
jobId: __expectString(output.jobId),
4504-
startedOn: output.startedOn !== undefined && output.startedOn !== null ? new Date(output.startedOn) : undefined,
4558+
startedOn:
4559+
output.startedOn !== undefined && output.startedOn !== null
4560+
? __expectNonNull(__parseRfc3339DateTime(output.startedOn))
4561+
: undefined,
45054562
status: __expectString(output.status),
45064563
} as any;
45074564
};
@@ -4680,10 +4737,15 @@ const deserializeAws_restJson1PathElementList = (output: any, context: __SerdeCo
46804737
const deserializeAws_restJson1PolicyGeneration = (output: any, context: __SerdeContext): PolicyGeneration => {
46814738
return {
46824739
completedOn:
4683-
output.completedOn !== undefined && output.completedOn !== null ? new Date(output.completedOn) : undefined,
4740+
output.completedOn !== undefined && output.completedOn !== null
4741+
? __expectNonNull(__parseRfc3339DateTime(output.completedOn))
4742+
: undefined,
46844743
jobId: __expectString(output.jobId),
46854744
principalArn: __expectString(output.principalArn),
4686-
startedOn: output.startedOn !== undefined && output.startedOn !== null ? new Date(output.startedOn) : undefined,
4745+
startedOn:
4746+
output.startedOn !== undefined && output.startedOn !== null
4747+
? __expectNonNull(__parseRfc3339DateTime(output.startedOn))
4748+
: undefined,
46874749
status: __expectString(output.status),
46884750
} as any;
46894751
};

clients/client-acm-pca/protocols/Aws_json1_1.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@a
143143
import {
144144
expectBoolean as __expectBoolean,
145145
expectInt32 as __expectInt32,
146+
expectNonNull as __expectNonNull,
147+
expectNumber as __expectNumber,
146148
expectString as __expectString,
149+
parseEpochTimestamp as __parseEpochTimestamp,
147150
} from "@aws-sdk/smithy-client";
148151
import {
149152
Endpoint as __Endpoint,
@@ -3297,26 +3300,26 @@ const deserializeAws_json1_1CertificateAuthority = (output: any, context: __Serd
32973300
: undefined,
32983301
CreatedAt:
32993302
output.CreatedAt !== undefined && output.CreatedAt !== null
3300-
? new Date(Math.round(output.CreatedAt * 1000))
3303+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreatedAt)))
33013304
: undefined,
33023305
FailureReason: __expectString(output.FailureReason),
33033306
KeyStorageSecurityStandard: __expectString(output.KeyStorageSecurityStandard),
33043307
LastStateChangeAt:
33053308
output.LastStateChangeAt !== undefined && output.LastStateChangeAt !== null
3306-
? new Date(Math.round(output.LastStateChangeAt * 1000))
3309+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastStateChangeAt)))
33073310
: undefined,
33083311
NotAfter:
33093312
output.NotAfter !== undefined && output.NotAfter !== null
3310-
? new Date(Math.round(output.NotAfter * 1000))
3313+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.NotAfter)))
33113314
: undefined,
33123315
NotBefore:
33133316
output.NotBefore !== undefined && output.NotBefore !== null
3314-
? new Date(Math.round(output.NotBefore * 1000))
3317+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.NotBefore)))
33153318
: undefined,
33163319
OwnerAccount: __expectString(output.OwnerAccount),
33173320
RestorableUntil:
33183321
output.RestorableUntil !== undefined && output.RestorableUntil !== null
3319-
? new Date(Math.round(output.RestorableUntil * 1000))
3322+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.RestorableUntil)))
33203323
: undefined,
33213324
RevocationConfiguration:
33223325
output.RevocationConfiguration !== undefined && output.RevocationConfiguration !== null
@@ -3414,7 +3417,7 @@ const deserializeAws_json1_1DescribeCertificateAuthorityAuditReportResponse = (
34143417
AuditReportStatus: __expectString(output.AuditReportStatus),
34153418
CreatedAt:
34163419
output.CreatedAt !== undefined && output.CreatedAt !== null
3417-
? new Date(Math.round(output.CreatedAt * 1000))
3420+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreatedAt)))
34183421
: undefined,
34193422
S3BucketName: __expectString(output.S3BucketName),
34203423
S3Key: __expectString(output.S3Key),
@@ -3654,7 +3657,7 @@ const deserializeAws_json1_1Permission = (output: any, context: __SerdeContext):
36543657
CertificateAuthorityArn: __expectString(output.CertificateAuthorityArn),
36553658
CreatedAt:
36563659
output.CreatedAt !== undefined && output.CreatedAt !== null
3657-
? new Date(Math.round(output.CreatedAt * 1000))
3660+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreatedAt)))
36583661
: undefined,
36593662
Policy: __expectString(output.Policy),
36603663
Principal: __expectString(output.Principal),

clients/client-acm/protocols/Aws_json1_1.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ import {
9494
ValidationException,
9595
} from "../models/models_0";
9696
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
97-
import { expectInt32 as __expectInt32, expectString as __expectString } from "@aws-sdk/smithy-client";
97+
import {
98+
expectInt32 as __expectInt32,
99+
expectNonNull as __expectNonNull,
100+
expectNumber as __expectNumber,
101+
expectString as __expectString,
102+
parseEpochTimestamp as __parseEpochTimestamp,
103+
} from "@aws-sdk/smithy-client";
98104
import {
99105
Endpoint as __Endpoint,
100106
HeaderBag as __HeaderBag,
@@ -1981,7 +1987,7 @@ const deserializeAws_json1_1CertificateDetail = (output: any, context: __SerdeCo
19811987
CertificateAuthorityArn: __expectString(output.CertificateAuthorityArn),
19821988
CreatedAt:
19831989
output.CreatedAt !== undefined && output.CreatedAt !== null
1984-
? new Date(Math.round(output.CreatedAt * 1000))
1990+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreatedAt)))
19851991
: undefined,
19861992
DomainName: __expectString(output.DomainName),
19871993
DomainValidationOptions:
@@ -1995,15 +2001,15 @@ const deserializeAws_json1_1CertificateDetail = (output: any, context: __SerdeCo
19952001
FailureReason: __expectString(output.FailureReason),
19962002
ImportedAt:
19972003
output.ImportedAt !== undefined && output.ImportedAt !== null
1998-
? new Date(Math.round(output.ImportedAt * 1000))
2004+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.ImportedAt)))
19992005
: undefined,
20002006
InUseBy:
20012007
output.InUseBy !== undefined && output.InUseBy !== null
20022008
? deserializeAws_json1_1InUseList(output.InUseBy, context)
20032009
: undefined,
20042010
IssuedAt:
20052011
output.IssuedAt !== undefined && output.IssuedAt !== null
2006-
? new Date(Math.round(output.IssuedAt * 1000))
2012+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.IssuedAt)))
20072013
: undefined,
20082014
Issuer: __expectString(output.Issuer),
20092015
KeyAlgorithm: __expectString(output.KeyAlgorithm),
@@ -2013,11 +2019,11 @@ const deserializeAws_json1_1CertificateDetail = (output: any, context: __SerdeCo
20132019
: undefined,
20142020
NotAfter:
20152021
output.NotAfter !== undefined && output.NotAfter !== null
2016-
? new Date(Math.round(output.NotAfter * 1000))
2022+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.NotAfter)))
20172023
: undefined,
20182024
NotBefore:
20192025
output.NotBefore !== undefined && output.NotBefore !== null
2020-
? new Date(Math.round(output.NotBefore * 1000))
2026+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.NotBefore)))
20212027
: undefined,
20222028
Options:
20232029
output.Options !== undefined && output.Options !== null
@@ -2031,7 +2037,7 @@ const deserializeAws_json1_1CertificateDetail = (output: any, context: __SerdeCo
20312037
RevocationReason: __expectString(output.RevocationReason),
20322038
RevokedAt:
20332039
output.RevokedAt !== undefined && output.RevokedAt !== null
2034-
? new Date(Math.round(output.RevokedAt * 1000))
2040+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.RevokedAt)))
20352041
: undefined,
20362042
Serial: __expectString(output.Serial),
20372043
SignatureAlgorithm: __expectString(output.SignatureAlgorithm),
@@ -2303,7 +2309,7 @@ const deserializeAws_json1_1RenewalSummary = (output: any, context: __SerdeConte
23032309
RenewalStatusReason: __expectString(output.RenewalStatusReason),
23042310
UpdatedAt:
23052311
output.UpdatedAt !== undefined && output.UpdatedAt !== null
2306-
? new Date(Math.round(output.UpdatedAt * 1000))
2312+
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.UpdatedAt)))
23072313
: undefined,
23082314
} as any;
23092315
};

0 commit comments

Comments
 (0)