-
Notifications
You must be signed in to change notification settings - Fork 243
/
client.rs
4413 lines (4406 loc) · 202 KB
/
client.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
client: smithy_client::Client<C, M, R>,
conf: crate::Config,
}
/// An ergonomic service client for `AWSWAF_20190729`.
///
/// This client allows ergonomic access to a `AWSWAF_20190729`-shaped service.
/// Each method corresponds to an endpoint defined in the service's Smithy model,
/// and the request and response shapes are auto-generated from that same model.
///
/// # Using a Client
///
/// Once you have a client set up, you can access the service's endpoints
/// by calling the appropriate method on [`Client`]. Each such method
/// returns a request builder for that endpoint, with methods for setting
/// the various fields of the request. Once your request is complete, use
/// the `send` method to send the request. `send` returns a future, which
/// you then have to `.await` to get the service's response.
///
/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#c-builder
/// [SigV4-signed requests]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
#[derive(std::fmt::Debug)]
pub struct Client<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<Handle<C, M, R>>,
}
impl<C, M, R> std::clone::Clone for Client<C, M, R> {
fn clone(&self) -> Self {
Self {
handle: self.handle.clone(),
}
}
}
#[doc(inline)]
pub use smithy_client::Builder;
impl<C, M, R> From<smithy_client::Client<C, M, R>> for Client<C, M, R> {
fn from(client: smithy_client::Client<C, M, R>) -> Self {
Self::with_config(client, crate::Config::builder().build())
}
}
impl<C, M, R> Client<C, M, R> {
pub fn with_config(client: smithy_client::Client<C, M, R>, conf: crate::Config) -> Self {
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
pub fn conf(&self) -> &crate::Config {
&self.handle.conf
}
}
impl<C, M, R> Client<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub fn associate_web_acl(&self) -> fluent_builders::AssociateWebACL<C, M, R> {
fluent_builders::AssociateWebACL::new(self.handle.clone())
}
pub fn check_capacity(&self) -> fluent_builders::CheckCapacity<C, M, R> {
fluent_builders::CheckCapacity::new(self.handle.clone())
}
pub fn create_ip_set(&self) -> fluent_builders::CreateIPSet<C, M, R> {
fluent_builders::CreateIPSet::new(self.handle.clone())
}
pub fn create_regex_pattern_set(&self) -> fluent_builders::CreateRegexPatternSet<C, M, R> {
fluent_builders::CreateRegexPatternSet::new(self.handle.clone())
}
pub fn create_rule_group(&self) -> fluent_builders::CreateRuleGroup<C, M, R> {
fluent_builders::CreateRuleGroup::new(self.handle.clone())
}
pub fn create_web_acl(&self) -> fluent_builders::CreateWebACL<C, M, R> {
fluent_builders::CreateWebACL::new(self.handle.clone())
}
pub fn delete_firewall_manager_rule_groups(
&self,
) -> fluent_builders::DeleteFirewallManagerRuleGroups<C, M, R> {
fluent_builders::DeleteFirewallManagerRuleGroups::new(self.handle.clone())
}
pub fn delete_ip_set(&self) -> fluent_builders::DeleteIPSet<C, M, R> {
fluent_builders::DeleteIPSet::new(self.handle.clone())
}
pub fn delete_logging_configuration(
&self,
) -> fluent_builders::DeleteLoggingConfiguration<C, M, R> {
fluent_builders::DeleteLoggingConfiguration::new(self.handle.clone())
}
pub fn delete_permission_policy(&self) -> fluent_builders::DeletePermissionPolicy<C, M, R> {
fluent_builders::DeletePermissionPolicy::new(self.handle.clone())
}
pub fn delete_regex_pattern_set(&self) -> fluent_builders::DeleteRegexPatternSet<C, M, R> {
fluent_builders::DeleteRegexPatternSet::new(self.handle.clone())
}
pub fn delete_rule_group(&self) -> fluent_builders::DeleteRuleGroup<C, M, R> {
fluent_builders::DeleteRuleGroup::new(self.handle.clone())
}
pub fn delete_web_acl(&self) -> fluent_builders::DeleteWebACL<C, M, R> {
fluent_builders::DeleteWebACL::new(self.handle.clone())
}
pub fn describe_managed_rule_group(
&self,
) -> fluent_builders::DescribeManagedRuleGroup<C, M, R> {
fluent_builders::DescribeManagedRuleGroup::new(self.handle.clone())
}
pub fn disassociate_web_acl(&self) -> fluent_builders::DisassociateWebACL<C, M, R> {
fluent_builders::DisassociateWebACL::new(self.handle.clone())
}
pub fn get_ip_set(&self) -> fluent_builders::GetIPSet<C, M, R> {
fluent_builders::GetIPSet::new(self.handle.clone())
}
pub fn get_logging_configuration(&self) -> fluent_builders::GetLoggingConfiguration<C, M, R> {
fluent_builders::GetLoggingConfiguration::new(self.handle.clone())
}
pub fn get_managed_rule_set(&self) -> fluent_builders::GetManagedRuleSet<C, M, R> {
fluent_builders::GetManagedRuleSet::new(self.handle.clone())
}
pub fn get_permission_policy(&self) -> fluent_builders::GetPermissionPolicy<C, M, R> {
fluent_builders::GetPermissionPolicy::new(self.handle.clone())
}
pub fn get_rate_based_statement_managed_keys(
&self,
) -> fluent_builders::GetRateBasedStatementManagedKeys<C, M, R> {
fluent_builders::GetRateBasedStatementManagedKeys::new(self.handle.clone())
}
pub fn get_regex_pattern_set(&self) -> fluent_builders::GetRegexPatternSet<C, M, R> {
fluent_builders::GetRegexPatternSet::new(self.handle.clone())
}
pub fn get_rule_group(&self) -> fluent_builders::GetRuleGroup<C, M, R> {
fluent_builders::GetRuleGroup::new(self.handle.clone())
}
pub fn get_sampled_requests(&self) -> fluent_builders::GetSampledRequests<C, M, R> {
fluent_builders::GetSampledRequests::new(self.handle.clone())
}
pub fn get_web_acl(&self) -> fluent_builders::GetWebACL<C, M, R> {
fluent_builders::GetWebACL::new(self.handle.clone())
}
pub fn get_web_acl_for_resource(&self) -> fluent_builders::GetWebACLForResource<C, M, R> {
fluent_builders::GetWebACLForResource::new(self.handle.clone())
}
pub fn list_available_managed_rule_groups(
&self,
) -> fluent_builders::ListAvailableManagedRuleGroups<C, M, R> {
fluent_builders::ListAvailableManagedRuleGroups::new(self.handle.clone())
}
pub fn list_available_managed_rule_group_versions(
&self,
) -> fluent_builders::ListAvailableManagedRuleGroupVersions<C, M, R> {
fluent_builders::ListAvailableManagedRuleGroupVersions::new(self.handle.clone())
}
pub fn list_ip_sets(&self) -> fluent_builders::ListIPSets<C, M, R> {
fluent_builders::ListIPSets::new(self.handle.clone())
}
pub fn list_logging_configurations(
&self,
) -> fluent_builders::ListLoggingConfigurations<C, M, R> {
fluent_builders::ListLoggingConfigurations::new(self.handle.clone())
}
pub fn list_managed_rule_sets(&self) -> fluent_builders::ListManagedRuleSets<C, M, R> {
fluent_builders::ListManagedRuleSets::new(self.handle.clone())
}
pub fn list_regex_pattern_sets(&self) -> fluent_builders::ListRegexPatternSets<C, M, R> {
fluent_builders::ListRegexPatternSets::new(self.handle.clone())
}
pub fn list_resources_for_web_acl(&self) -> fluent_builders::ListResourcesForWebACL<C, M, R> {
fluent_builders::ListResourcesForWebACL::new(self.handle.clone())
}
pub fn list_rule_groups(&self) -> fluent_builders::ListRuleGroups<C, M, R> {
fluent_builders::ListRuleGroups::new(self.handle.clone())
}
pub fn list_tags_for_resource(&self) -> fluent_builders::ListTagsForResource<C, M, R> {
fluent_builders::ListTagsForResource::new(self.handle.clone())
}
pub fn list_web_ac_ls(&self) -> fluent_builders::ListWebACLs<C, M, R> {
fluent_builders::ListWebACLs::new(self.handle.clone())
}
pub fn put_logging_configuration(&self) -> fluent_builders::PutLoggingConfiguration<C, M, R> {
fluent_builders::PutLoggingConfiguration::new(self.handle.clone())
}
pub fn put_managed_rule_set_versions(
&self,
) -> fluent_builders::PutManagedRuleSetVersions<C, M, R> {
fluent_builders::PutManagedRuleSetVersions::new(self.handle.clone())
}
pub fn put_permission_policy(&self) -> fluent_builders::PutPermissionPolicy<C, M, R> {
fluent_builders::PutPermissionPolicy::new(self.handle.clone())
}
pub fn tag_resource(&self) -> fluent_builders::TagResource<C, M, R> {
fluent_builders::TagResource::new(self.handle.clone())
}
pub fn untag_resource(&self) -> fluent_builders::UntagResource<C, M, R> {
fluent_builders::UntagResource::new(self.handle.clone())
}
pub fn update_ip_set(&self) -> fluent_builders::UpdateIPSet<C, M, R> {
fluent_builders::UpdateIPSet::new(self.handle.clone())
}
pub fn update_managed_rule_set_version_expiry_date(
&self,
) -> fluent_builders::UpdateManagedRuleSetVersionExpiryDate<C, M, R> {
fluent_builders::UpdateManagedRuleSetVersionExpiryDate::new(self.handle.clone())
}
pub fn update_regex_pattern_set(&self) -> fluent_builders::UpdateRegexPatternSet<C, M, R> {
fluent_builders::UpdateRegexPatternSet::new(self.handle.clone())
}
pub fn update_rule_group(&self) -> fluent_builders::UpdateRuleGroup<C, M, R> {
fluent_builders::UpdateRuleGroup::new(self.handle.clone())
}
pub fn update_web_acl(&self) -> fluent_builders::UpdateWebACL<C, M, R> {
fluent_builders::UpdateWebACL::new(self.handle.clone())
}
}
pub mod fluent_builders {
#[derive(std::fmt::Debug)]
pub struct AssociateWebACL<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::associate_web_acl_input::Builder,
}
impl<C, M, R> AssociateWebACL<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::AssociateWebAclOutput,
smithy_http::result::SdkError<crate::error::AssociateWebACLError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::AssociateWebAclInputOperationOutputAlias,
crate::output::AssociateWebAclOutput,
crate::error::AssociateWebACLError,
crate::input::AssociateWebAclInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>The Amazon Resource Name (ARN) of the web ACL that you want to associate with the
/// resource.</p>
pub fn web_acl_arn(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.web_acl_arn(inp);
self
}
pub fn set_web_acl_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_web_acl_arn(input);
self
}
/// <p>The Amazon Resource Name (ARN) of the resource to associate with the web ACL. </p>
/// <p>The ARN must be in one of the following formats:</p>
/// <ul>
/// <li>
/// <p>For an Application Load Balancer: <code>arn:aws:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i>
/// </code>
/// </p>
/// </li>
/// <li>
/// <p>For an Amazon API Gateway REST API: <code>arn:aws:apigateway:<i>region</i>::/restapis/<i>api-id</i>/stages/<i>stage-name</i>
/// </code>
/// </p>
/// </li>
/// <li>
/// <p>For an AppSync GraphQL API: <code>arn:aws:appsync:<i>region</i>:<i>account-id</i>:apis/<i>GraphQLApiId</i>
/// </code>
/// </p>
/// </li>
/// </ul>
pub fn resource_arn(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.resource_arn(inp);
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_resource_arn(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct CheckCapacity<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::check_capacity_input::Builder,
}
impl<C, M, R> CheckCapacity<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::CheckCapacityOutput,
smithy_http::result::SdkError<crate::error::CheckCapacityError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::CheckCapacityInputOperationOutputAlias,
crate::output::CheckCapacityOutput,
crate::error::CheckCapacityError,
crate::input::CheckCapacityInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, or an AppSync GraphQL API. </p>
/// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
/// <ul>
/// <li>
/// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
/// </li>
/// <li>
/// <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
/// </li>
/// </ul>
pub fn scope(mut self, inp: crate::model::Scope) -> Self {
self.inner = self.inner.scope(inp);
self
}
pub fn set_scope(mut self, input: std::option::Option<crate::model::Scope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// Appends an item to `Rules`.
///
/// To override the contents of this collection use [`set_rules`](Self::set_rules).
/// <p>An array of <a>Rule</a> that you're configuring to use in a rule group or web
/// ACL. </p>
pub fn rules(mut self, inp: impl Into<crate::model::Rule>) -> Self {
self.inner = self.inner.rules(inp);
self
}
pub fn set_rules(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Rule>>,
) -> Self {
self.inner = self.inner.set_rules(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct CreateIPSet<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::create_ip_set_input::Builder,
}
impl<C, M, R> CreateIPSet<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::CreateIpSetOutput,
smithy_http::result::SdkError<crate::error::CreateIPSetError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::CreateIpSetInputOperationOutputAlias,
crate::output::CreateIpSetOutput,
crate::error::CreateIPSetError,
crate::input::CreateIpSetInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>The name of the IP set. You cannot change the name of an <code>IPSet</code> after you create it.</p>
pub fn name(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(inp);
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, or an AppSync GraphQL API. </p>
/// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
/// <ul>
/// <li>
/// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
/// </li>
/// <li>
/// <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
/// </li>
/// </ul>
pub fn scope(mut self, inp: crate::model::Scope) -> Self {
self.inner = self.inner.scope(inp);
self
}
pub fn set_scope(mut self, input: std::option::Option<crate::model::Scope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// <p>A description of the IP set that helps with identification. </p>
pub fn description(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.description(inp);
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>. </p>
pub fn ip_address_version(mut self, inp: crate::model::IpAddressVersion) -> Self {
self.inner = self.inner.ip_address_version(inp);
self
}
pub fn set_ip_address_version(
mut self,
input: std::option::Option<crate::model::IpAddressVersion>,
) -> Self {
self.inner = self.inner.set_ip_address_version(input);
self
}
/// Appends an item to `Addresses`.
///
/// To override the contents of this collection use [`set_addresses`](Self::set_addresses).
/// <p>Contains an array of strings that specify one or more IP addresses or blocks of IP addresses in Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for /0. </p>
/// <p>Examples: </p>
/// <ul>
/// <li>
/// <p>To configure WAF to allow, block, or count requests that originated from the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>.</p>
/// </li>
/// <li>
/// <p>To configure WAF to allow, block, or count requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify
/// <code>192.0.2.0/24</code>.</p>
/// </li>
/// <li>
/// <p>To configure WAF to allow, block, or count requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify <code>1111:0000:0000:0000:0000:0000:0000:0111/128</code>.</p>
/// </li>
/// <li>
/// <p>To configure WAF to allow, block, or count requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify <code>1111:0000:0000:0000:0000:0000:0000:0000/64</code>.</p>
/// </li>
/// </ul>
/// <p>For more information about CIDR notation, see the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>.</p>
pub fn addresses(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.addresses(inp);
self
}
pub fn set_addresses(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_addresses(input);
self
}
/// Appends an item to `Tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
/// <p>An array of key:value pairs to associate with the resource.</p>
pub fn tags(mut self, inp: impl Into<crate::model::Tag>) -> Self {
self.inner = self.inner.tags(inp);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Tag>>,
) -> Self {
self.inner = self.inner.set_tags(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct CreateRegexPatternSet<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::create_regex_pattern_set_input::Builder,
}
impl<C, M, R> CreateRegexPatternSet<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::CreateRegexPatternSetOutput,
smithy_http::result::SdkError<crate::error::CreateRegexPatternSetError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::CreateRegexPatternSetInputOperationOutputAlias,
crate::output::CreateRegexPatternSetOutput,
crate::error::CreateRegexPatternSetError,
crate::input::CreateRegexPatternSetInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>The name of the set. You cannot change the name after you create the set.</p>
pub fn name(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(inp);
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, or an AppSync GraphQL API. </p>
/// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
/// <ul>
/// <li>
/// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
/// </li>
/// <li>
/// <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
/// </li>
/// </ul>
pub fn scope(mut self, inp: crate::model::Scope) -> Self {
self.inner = self.inner.scope(inp);
self
}
pub fn set_scope(mut self, input: std::option::Option<crate::model::Scope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// <p>A description of the set that helps with identification. </p>
pub fn description(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.description(inp);
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// Appends an item to `RegularExpressionList`.
///
/// To override the contents of this collection use [`set_regular_expression_list`](Self::set_regular_expression_list).
/// <p>Array of regular expression strings. </p>
pub fn regular_expression_list(mut self, inp: impl Into<crate::model::Regex>) -> Self {
self.inner = self.inner.regular_expression_list(inp);
self
}
pub fn set_regular_expression_list(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Regex>>,
) -> Self {
self.inner = self.inner.set_regular_expression_list(input);
self
}
/// Appends an item to `Tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
/// <p>An array of key:value pairs to associate with the resource.</p>
pub fn tags(mut self, inp: impl Into<crate::model::Tag>) -> Self {
self.inner = self.inner.tags(inp);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Tag>>,
) -> Self {
self.inner = self.inner.set_tags(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct CreateRuleGroup<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::create_rule_group_input::Builder,
}
impl<C, M, R> CreateRuleGroup<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::CreateRuleGroupOutput,
smithy_http::result::SdkError<crate::error::CreateRuleGroupError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::CreateRuleGroupInputOperationOutputAlias,
crate::output::CreateRuleGroupOutput,
crate::error::CreateRuleGroupError,
crate::input::CreateRuleGroupInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
pub fn name(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(inp);
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, or an AppSync GraphQL API. </p>
/// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
/// <ul>
/// <li>
/// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
/// </li>
/// <li>
/// <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
/// </li>
/// </ul>
pub fn scope(mut self, inp: crate::model::Scope) -> Self {
self.inner = self.inner.scope(inp);
self
}
pub fn set_scope(mut self, input: std::option::Option<crate::model::Scope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// <p>The web ACL capacity units (WCUs) required for this rule group.</p>
/// <p>When you create your own rule group, you define this, and you cannot change it after creation.
/// When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity
/// for a set of rules using <a>CheckCapacity</a>.</p>
/// <p>WAF uses WCUs to calculate and control the operating
/// resources that are used to run your rules, rule groups, and web ACLs. WAF
/// calculates capacity differently for each rule type, to reflect the relative cost of each rule.
/// Simple rules that cost little to run use fewer WCUs than more complex rules
/// that use more processing power.
/// Rule group capacity is fixed at creation, which helps users plan their
/// web ACL WCU usage when they use a rule group.
/// The WCU limit for web ACLs is 1,500. </p>
pub fn capacity(mut self, inp: i64) -> Self {
self.inner = self.inner.capacity(inp);
self
}
pub fn set_capacity(mut self, input: std::option::Option<i64>) -> Self {
self.inner = self.inner.set_capacity(input);
self
}
/// <p>A description of the rule group that helps with identification. </p>
pub fn description(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.description(inp);
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// Appends an item to `Rules`.
///
/// To override the contents of this collection use [`set_rules`](Self::set_rules).
/// <p>The <a>Rule</a> statements used to identify the web requests that you
/// want to allow, block, or count. Each rule includes one top-level statement that WAF uses to identify matching
/// web requests, and parameters that govern how WAF handles them.
/// </p>
pub fn rules(mut self, inp: impl Into<crate::model::Rule>) -> Self {
self.inner = self.inner.rules(inp);
self
}
pub fn set_rules(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Rule>>,
) -> Self {
self.inner = self.inner.set_rules(input);
self
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection. </p>
pub fn visibility_config(mut self, inp: crate::model::VisibilityConfig) -> Self {
self.inner = self.inner.visibility_config(inp);
self
}
pub fn set_visibility_config(
mut self,
input: std::option::Option<crate::model::VisibilityConfig>,
) -> Self {
self.inner = self.inner.set_visibility_config(input);
self
}
/// Appends an item to `Tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
/// <p>An array of key:value pairs to associate with the resource.</p>
pub fn tags(mut self, inp: impl Into<crate::model::Tag>) -> Self {
self.inner = self.inner.tags(inp);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Tag>>,
) -> Self {
self.inner = self.inner.set_tags(input);
self
}
/// Adds a key-value pair to `CustomResponseBodies`.
///
/// To override the contents of this collection use [`set_custom_response_bodies`](Self::set_custom_response_bodies).
/// <p>A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group. </p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the
/// <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">WAF Developer Guide</a>. </p>
/// <p>For information about the limits on count and size for custom request and response settings, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">WAF quotas</a> in the
/// <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">WAF Developer Guide</a>. </p>
pub fn custom_response_bodies(
mut self,
k: impl Into<std::string::String>,
v: impl Into<crate::model::CustomResponseBody>,
) -> Self {
self.inner = self.inner.custom_response_bodies(k, v);
self
}
pub fn set_custom_response_bodies(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, crate::model::CustomResponseBody>,
>,
) -> Self {
self.inner = self.inner.set_custom_response_bodies(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct CreateWebACL<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::create_web_acl_input::Builder,
}
impl<C, M, R> CreateWebACL<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::CreateWebAclOutput,
smithy_http::result::SdkError<crate::error::CreateWebACLError>,
>
where
R::Policy: smithy_client::bounds::SmithyRetryPolicy<
crate::input::CreateWebAclInputOperationOutputAlias,
crate::output::CreateWebAclOutput,
crate::error::CreateWebACLError,
crate::input::CreateWebAclInputOperationRetryAlias,
>,
{
let input = self
.inner
.build()
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
let op = input
.make_operation(&self.handle.conf)
.map_err(|err| smithy_http::result::SdkError::ConstructionFailure(err.into()))?;
self.handle.client.call(op).await
}
/// <p>The name of the web ACL. You cannot change the name of a web ACL after you create it.</p>
pub fn name(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(inp);
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, or an AppSync GraphQL API. </p>
/// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
/// <ul>
/// <li>
/// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
/// </li>
/// <li>
/// <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
/// </li>
/// </ul>
pub fn scope(mut self, inp: crate::model::Scope) -> Self {
self.inner = self.inner.scope(inp);
self
}
pub fn set_scope(mut self, input: std::option::Option<crate::model::Scope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// <p>The action to perform if none of the <code>Rules</code> contained in the <code>WebACL</code> match. </p>
pub fn default_action(mut self, inp: crate::model::DefaultAction) -> Self {
self.inner = self.inner.default_action(inp);
self
}
pub fn set_default_action(
mut self,
input: std::option::Option<crate::model::DefaultAction>,
) -> Self {
self.inner = self.inner.set_default_action(input);
self
}
/// <p>A description of the web ACL that helps with identification. </p>
pub fn description(mut self, inp: impl Into<std::string::String>) -> Self {
self.inner = self.inner.description(inp);
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// Appends an item to `Rules`.
///
/// To override the contents of this collection use [`set_rules`](Self::set_rules).
/// <p>The <a>Rule</a> statements used to identify the web requests that you
/// want to allow, block, or count. Each rule includes one top-level statement that WAF uses to identify matching
/// web requests, and parameters that govern how WAF handles them.
/// </p>
pub fn rules(mut self, inp: impl Into<crate::model::Rule>) -> Self {
self.inner = self.inner.rules(inp);
self
}
pub fn set_rules(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Rule>>,
) -> Self {
self.inner = self.inner.set_rules(input);
self
}
/// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection. </p>
pub fn visibility_config(mut self, inp: crate::model::VisibilityConfig) -> Self {
self.inner = self.inner.visibility_config(inp);
self
}
pub fn set_visibility_config(
mut self,
input: std::option::Option<crate::model::VisibilityConfig>,
) -> Self {
self.inner = self.inner.set_visibility_config(input);
self
}
/// Appends an item to `Tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
/// <p>An array of key:value pairs to associate with the resource.</p>
pub fn tags(mut self, inp: impl Into<crate::model::Tag>) -> Self {
self.inner = self.inner.tags(inp);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Tag>>,
) -> Self {
self.inner = self.inner.set_tags(input);
self
}
/// Adds a key-value pair to `CustomResponseBodies`.
///
/// To override the contents of this collection use [`set_custom_response_bodies`](Self::set_custom_response_bodies).
/// <p>A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the web ACL, and then use them in the rules and default actions that you define in the web ACL. </p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the
/// <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">WAF Developer Guide</a>. </p>
/// <p>For information about the limits on count and size for custom request and response settings, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">WAF quotas</a> in the
/// <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">WAF Developer Guide</a>. </p>
pub fn custom_response_bodies(
mut self,
k: impl Into<std::string::String>,
v: impl Into<crate::model::CustomResponseBody>,
) -> Self {
self.inner = self.inner.custom_response_bodies(k, v);
self
}
pub fn set_custom_response_bodies(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, crate::model::CustomResponseBody>,
>,
) -> Self {
self.inner = self.inner.set_custom_response_bodies(input);
self
}
}
#[derive(std::fmt::Debug)]
pub struct DeleteFirewallManagerRuleGroups<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::retry::Standard,
> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::delete_firewall_manager_rule_groups_input::Builder,
}
impl<C, M, R> DeleteFirewallManagerRuleGroups<C, M, R>
where
C: smithy_client::bounds::SmithyConnector,
M: smithy_client::bounds::SmithyMiddleware<C>,
R: smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
pub async fn send(
self,
) -> std::result::Result<
crate::output::DeleteFirewallManagerRuleGroupsOutput,
smithy_http::result::SdkError<crate::error::DeleteFirewallManagerRuleGroupsError>,
>
where