Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 074f7de

Browse files
authored
Implement Default in structures that allow it. (#108)
Signed-off-by: David Calavera <david.calavera@gmail.com> Signed-off-by: David Calavera <david.calavera@gmail.com>
1 parent be3008c commit 074f7de

31 files changed

+217
-221
lines changed

aws_lambda_events/src/alb/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use http::{HeaderMap, Method};
44
use query_map::QueryMap;
55

66
/// `AlbTargetGroupRequest` contains data originating from the ALB Lambda target group integration
7-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
88
#[serde(rename_all = "camelCase")]
99
pub struct AlbTargetGroupRequest {
1010
#[serde(with = "http_method")]
@@ -28,14 +28,14 @@ pub struct AlbTargetGroupRequest {
2828
}
2929

3030
/// `AlbTargetGroupRequestContext` contains the information to identify the load balancer invoking the lambda
31-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
31+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
3232
#[serde(rename_all = "camelCase")]
3333
pub struct AlbTargetGroupRequestContext {
3434
pub elb: ElbContext,
3535
}
3636

3737
/// `ElbContext` contains the information to identify the ARN invoking the lambda
38-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
38+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
3939
#[serde(rename_all = "camelCase")]
4040
pub struct ElbContext {
4141
/// nolint: stylecheck
@@ -45,7 +45,7 @@ pub struct ElbContext {
4545
}
4646

4747
/// `AlbTargetGroupResponse` configures the response to be returned by the ALB Lambda target group for the request
48-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
48+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
4949
#[serde(rename_all = "camelCase")]
5050
pub struct AlbTargetGroupResponse {
5151
pub status_code: i64,

aws_lambda_events/src/apigw/mod.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde_json::Value;
88
use std::collections::HashMap;
99

1010
/// `ApiGatewayProxyRequest` contains data coming from the API Gateway proxy
11-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
11+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
1212
#[serde(rename_all = "camelCase")]
1313
pub struct ApiGatewayProxyRequest<T1 = Value>
1414
where
@@ -58,7 +58,7 @@ where
5858
}
5959

6060
/// `ApiGatewayProxyResponse` configures the response to be returned by API Gateway for the request
61-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
61+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
6262
#[serde(rename_all = "camelCase")]
6363
pub struct ApiGatewayProxyResponse {
6464
pub status_code: i64,
@@ -76,7 +76,7 @@ pub struct ApiGatewayProxyResponse {
7676

7777
/// `ApiGatewayProxyRequestContext` contains the information to identify the AWS account and resources invoking the
7878
/// Lambda function. It also includes Cognito identity information for the caller.
79-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default)]
79+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
8080
#[serde(rename_all = "camelCase")]
8181
pub struct ApiGatewayProxyRequestContext<T1 = Value>
8282
where
@@ -131,7 +131,7 @@ where
131131
}
132132

133133
/// `ApiGatewayV2httpRequest` contains data coming from the new HTTP API Gateway
134-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
134+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
135135
#[serde(rename_all = "camelCase")]
136136
pub struct ApiGatewayV2httpRequest {
137137
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -168,7 +168,7 @@ pub struct ApiGatewayV2httpRequest {
168168
}
169169

170170
/// `ApiGatewayV2httpRequestContext` contains the information to identify the AWS account and resources invoking the Lambda function.
171-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
171+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
172172
#[serde(rename_all = "camelCase")]
173173
pub struct ApiGatewayV2httpRequestContext<T1 = Value>
174174
where
@@ -209,7 +209,7 @@ where
209209
}
210210

211211
/// `ApiGatewayV2httpRequestContextAuthorizerDescription` contains authorizer information for the request context.
212-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default)]
212+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
213213
#[serde(rename_all = "camelCase")]
214214
pub struct ApiGatewayV2httpRequestContextAuthorizerDescription<T1 = Value>
215215
where
@@ -225,7 +225,7 @@ where
225225
}
226226

227227
/// `ApiGatewayV2httpRequestContextAuthorizerJwtDescription` contains JWT authorizer information for the request context.
228-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
228+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
229229
#[serde(rename_all = "camelCase")]
230230
pub struct ApiGatewayV2httpRequestContextAuthorizerJwtDescription {
231231
#[serde(deserialize_with = "deserialize_lambda_map")]
@@ -235,7 +235,7 @@ pub struct ApiGatewayV2httpRequestContextAuthorizerJwtDescription {
235235
}
236236

237237
/// `ApiGatewayV2httpRequestContextAuthorizerIamDescription` contains IAM information for the request context.
238-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
238+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
239239
#[serde(rename_all = "camelCase")]
240240
pub struct ApiGatewayV2httpRequestContextAuthorizerIamDescription {
241241
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -260,7 +260,7 @@ pub struct ApiGatewayV2httpRequestContextAuthorizerIamDescription {
260260
}
261261

262262
/// `ApiGatewayV2httpRequestContextAuthorizerCognitoIdentity` contains Cognito identity information for the request context.
263-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
263+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
264264
#[serde(rename_all = "camelCase")]
265265
pub struct ApiGatewayV2httpRequestContextAuthorizerCognitoIdentity {
266266
pub amr: Vec<String>,
@@ -273,7 +273,7 @@ pub struct ApiGatewayV2httpRequestContextAuthorizerCognitoIdentity {
273273
}
274274

275275
/// `ApiGatewayV2httpRequestContextHttpDescription` contains HTTP information for the request context.
276-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
276+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
277277
#[serde(rename_all = "camelCase")]
278278
pub struct ApiGatewayV2httpRequestContextHttpDescription {
279279
#[serde(with = "http_method")]
@@ -293,7 +293,7 @@ pub struct ApiGatewayV2httpRequestContextHttpDescription {
293293
}
294294

295295
/// `ApiGatewayV2httpResponse` configures the response to be returned by API Gateway V2 for the request
296-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
296+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
297297
#[serde(rename_all = "camelCase")]
298298
pub struct ApiGatewayV2httpResponse {
299299
pub status_code: i64,
@@ -311,7 +311,7 @@ pub struct ApiGatewayV2httpResponse {
311311
}
312312

313313
/// `ApiGatewayRequestIdentity` contains identity information for the request caller.
314-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default)]
314+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
315315
#[serde(rename_all = "camelCase")]
316316
pub struct ApiGatewayRequestIdentity {
317317
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -357,7 +357,7 @@ pub struct ApiGatewayRequestIdentity {
357357
}
358358

359359
/// `ApiGatewayWebsocketProxyRequest` contains data coming from the API Gateway proxy
360-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
360+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
361361
#[serde(rename_all = "camelCase")]
362362
pub struct ApiGatewayWebsocketProxyRequest<T1 = Value, T2 = Value>
363363
where
@@ -413,7 +413,7 @@ where
413413
/// `ApiGatewayWebsocketProxyRequestContext` contains the information to identify
414414
/// the AWS account and resources invoking the Lambda function. It also includes
415415
/// Cognito identity information for the caller.
416-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default)]
416+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
417417
#[serde(rename_all = "camelCase")]
418418
pub struct ApiGatewayWebsocketProxyRequestContext<T1 = Value, T2 = Value>
419419
where
@@ -488,7 +488,7 @@ where
488488
}
489489

490490
/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentity` contains identity information for the request caller including certificate information if using mTLS.
491-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
491+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
492492
#[serde(rename_all = "camelCase")]
493493
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity {
494494
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -505,7 +505,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity {
505505
}
506506

507507
/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert` contains certificate information for the request caller if using mTLS.
508-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
508+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
509509
#[serde(rename_all = "camelCase")]
510510
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert {
511511
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -526,7 +526,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert {
526526
}
527527

528528
/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity` contains certificate validity information for the request caller if using mTLS.
529-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
529+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
530530
#[serde(rename_all = "camelCase")]
531531
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity {
532532
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -538,15 +538,15 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidit
538538
}
539539

540540
/// `ApiGatewayV2httpRequestContextAuthentication` contains authentication context information for the request caller including client certificate information if using mTLS.
541-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
541+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
542542
#[serde(rename_all = "camelCase")]
543543
pub struct ApiGatewayV2httpRequestContextAuthentication {
544544
#[serde(default)]
545545
pub client_cert: Option<ApiGatewayV2httpRequestContextAuthenticationClientCert>,
546546
}
547547

548548
/// `ApiGatewayV2httpRequestContextAuthenticationClientCert` contains client certificate information for the request caller if using mTLS.
549-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
549+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
550550
#[serde(rename_all = "camelCase")]
551551
pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert {
552552
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -567,7 +567,7 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert {
567567
}
568568

569569
/// `ApiGatewayV2httpRequestContextAuthenticationClientCertValidity` contains client certificate validity information for the request caller if using mTLS.
570-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
570+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
571571
#[serde(rename_all = "camelCase")]
572572
pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity {
573573
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -578,7 +578,7 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity {
578578
pub not_before: Option<String>,
579579
}
580580

581-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
581+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
582582
#[serde(rename_all = "camelCase")]
583583
pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext {
584584
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -608,7 +608,7 @@ pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext {
608608
pub apiid: Option<String>,
609609
}
610610

611-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
611+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
612612
#[serde(rename_all = "camelCase")]
613613
pub struct ApiGatewayV2CustomAuthorizerV1Request {
614614
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -650,7 +650,7 @@ pub struct ApiGatewayV2CustomAuthorizerV1Request {
650650
pub request_context: ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext,
651651
}
652652

653-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
653+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
654654
#[serde(rename_all = "camelCase")]
655655
pub struct ApiGatewayV2CustomAuthorizerV2Request {
656656
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -691,7 +691,7 @@ pub struct ApiGatewayV2CustomAuthorizerV2Request {
691691

692692
/// `ApiGatewayCustomAuthorizerContext` represents the expected format of an API Gateway custom authorizer response.
693693
/// Deprecated. Code should be updated to use the Authorizer map from APIGatewayRequestIdentity. Ex: Authorizer["principalId"]
694-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
694+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
695695
#[serde(rename_all = "camelCase")]
696696
pub struct ApiGatewayCustomAuthorizerContext {
697697
pub principal_id: Option<String>,
@@ -702,7 +702,7 @@ pub struct ApiGatewayCustomAuthorizerContext {
702702
}
703703

704704
/// `ApiGatewayCustomAuthorizerRequestTypeRequestContext` represents the expected format of an API Gateway custom authorizer response.
705-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
705+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
706706
#[serde(rename_all = "camelCase")]
707707
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext {
708708
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -737,7 +737,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext {
737737
}
738738

739739
/// `ApiGatewayCustomAuthorizerRequest` contains data coming in to a custom API Gateway authorizer function.
740-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
740+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
741741
#[serde(rename_all = "camelCase")]
742742
pub struct ApiGatewayCustomAuthorizerRequest {
743743
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -753,7 +753,7 @@ pub struct ApiGatewayCustomAuthorizerRequest {
753753
}
754754

755755
/// `ApiGatewayCustomAuthorizerRequestTypeRequest` contains data coming in to a custom API Gateway authorizer function.
756-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
756+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
757757
#[serde(rename_all = "camelCase")]
758758
pub struct ApiGatewayCustomAuthorizerRequestTypeRequest {
759759
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -800,7 +800,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequest {
800800
}
801801

802802
/// `ApiGatewayCustomAuthorizerResponse` represents the expected format of an API Gateway authorization response.
803-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
803+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
804804
#[serde(rename_all = "camelCase")]
805805
pub struct ApiGatewayCustomAuthorizerResponse<T1 = Value>
806806
where
@@ -817,7 +817,7 @@ where
817817
}
818818

819819
/// `ApiGatewayV2CustomAuthorizerSimpleResponse` represents the simple format of an API Gateway V2 authorization response.
820-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
820+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
821821
#[serde(rename_all = "camelCase")]
822822
pub struct ApiGatewayV2CustomAuthorizerSimpleResponse<T1 = Value>
823823
where
@@ -829,7 +829,7 @@ where
829829
pub context: T1,
830830
}
831831

832-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
832+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
833833
#[serde(rename_all = "camelCase")]
834834
pub struct ApiGatewayV2CustomAuthorizerIamPolicyResponse<T1 = Value>
835835
where
@@ -845,7 +845,7 @@ where
845845
}
846846

847847
/// `ApiGatewayCustomAuthorizerPolicy` represents an IAM policy
848-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
848+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
849849
#[serde(rename_all = "camelCase")]
850850
pub struct ApiGatewayCustomAuthorizerPolicy {
851851
#[serde(deserialize_with = "deserialize_lambda_string")]
@@ -857,7 +857,7 @@ pub struct ApiGatewayCustomAuthorizerPolicy {
857857
}
858858

859859
/// `IamPolicyStatement` represents one statement from IAM policy with action, effect and resource
860-
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
860+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
861861
#[serde(rename_all = "camelCase")]
862862
pub struct IamPolicyStatement {
863863
#[serde(rename = "Action")]

aws_lambda_events/src/cloudwatch_events/cloudtrail.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use serde_derive::Deserialize;
22
use serde_derive::Serialize;
33
use serde_json::Value;
44

5-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
5+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
66
#[serde(rename_all = "camelCase")]
77
pub struct AWSAPICall<I = Value, O = Value> {
88
pub event_version: String,
@@ -25,7 +25,7 @@ pub struct AWSAPICall<I = Value, O = Value> {
2525
pub event_type: String,
2626
}
2727

28-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
28+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
2929
#[serde(rename_all = "camelCase")]
3030
pub struct UserIdentity {
3131
pub r#type: String,
@@ -35,13 +35,13 @@ pub struct UserIdentity {
3535
pub session_context: Option<SessionContext>,
3636
}
3737

38-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
38+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
3939
#[serde(rename_all = "camelCase")]
4040
pub struct SessionContext {
4141
pub attributes: Attributes,
4242
}
4343

44-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
44+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
4545
#[serde(rename_all = "camelCase")]
4646
pub struct Attributes {
4747
pub mfa_authenticated: String,

aws_lambda_events/src/cloudwatch_events/codedeploy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use serde_derive::Deserialize;
22
use serde_derive::Serialize;
33

4-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
4+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
55
#[serde(rename_all = "camelCase")]
66
pub struct StateChangeNotification {
77
pub instance_group_id: String,
@@ -12,7 +12,7 @@ pub struct StateChangeNotification {
1212
pub deployment_group: String,
1313
}
1414

15-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
15+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
1616
#[serde(rename_all = "camelCase")]
1717
pub struct DeploymentStateChangeNotification {
1818
pub instance_id: String,
@@ -24,7 +24,7 @@ pub struct DeploymentStateChangeNotification {
2424
pub deployment_group: String,
2525
}
2626

27-
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
27+
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
2828
#[serde(rename_all = "camelCase")]
2929
pub struct InstanceStateChangeNotification {
3030
pub pipeline: String,

0 commit comments

Comments
 (0)