-
Notifications
You must be signed in to change notification settings - Fork 244
/
input.rs
9429 lines (9356 loc) · 418 KB
/
input.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.
use std::fmt::Write;
/// See [`CreateAppInput`](crate::input::CreateAppInput)
pub mod create_app_input {
/// A builder for [`CreateAppInput`](crate::input::CreateAppInput)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) repository: std::option::Option<std::string::String>,
pub(crate) platform: std::option::Option<crate::model::Platform>,
pub(crate) iam_service_role_arn: std::option::Option<std::string::String>,
pub(crate) oauth_token: std::option::Option<std::string::String>,
pub(crate) access_token: std::option::Option<std::string::String>,
pub(crate) environment_variables: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) enable_branch_auto_build: std::option::Option<bool>,
pub(crate) enable_branch_auto_deletion: std::option::Option<bool>,
pub(crate) enable_basic_auth: std::option::Option<bool>,
pub(crate) basic_auth_credentials: std::option::Option<std::string::String>,
pub(crate) custom_rules: std::option::Option<std::vec::Vec<crate::model::CustomRule>>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) build_spec: std::option::Option<std::string::String>,
pub(crate) custom_headers: std::option::Option<std::string::String>,
pub(crate) enable_auto_branch_creation: std::option::Option<bool>,
pub(crate) auto_branch_creation_patterns:
std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) auto_branch_creation_config:
std::option::Option<crate::model::AutoBranchCreationConfig>,
}
impl Builder {
/// <p> The name for an Amplify app. </p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
/// <p> The name for an Amplify app. </p>
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
/// <p> The description for an Amplify app. </p>
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
/// <p> The description for an Amplify app. </p>
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
/// <p> The repository for an Amplify app. </p>
pub fn repository(mut self, input: impl Into<std::string::String>) -> Self {
self.repository = Some(input.into());
self
}
/// <p> The repository for an Amplify app. </p>
pub fn set_repository(mut self, input: std::option::Option<std::string::String>) -> Self {
self.repository = input;
self
}
/// <p> The platform or framework for an Amplify app. </p>
pub fn platform(mut self, input: crate::model::Platform) -> Self {
self.platform = Some(input);
self
}
/// <p> The platform or framework for an Amplify app. </p>
pub fn set_platform(mut self, input: std::option::Option<crate::model::Platform>) -> Self {
self.platform = input;
self
}
/// <p> The AWS Identity and Access Management (IAM) service role for an Amplify app. </p>
pub fn iam_service_role_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.iam_service_role_arn = Some(input.into());
self
}
/// <p> The AWS Identity and Access Management (IAM) service role for an Amplify app. </p>
pub fn set_iam_service_role_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.iam_service_role_arn = input;
self
}
/// <p> The OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. </p>
pub fn oauth_token(mut self, input: impl Into<std::string::String>) -> Self {
self.oauth_token = Some(input.into());
self
}
/// <p> The OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. </p>
pub fn set_oauth_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.oauth_token = input;
self
}
/// <p> The personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. </p>
pub fn access_token(mut self, input: impl Into<std::string::String>) -> Self {
self.access_token = Some(input.into());
self
}
/// <p> The personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. </p>
pub fn set_access_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.access_token = input;
self
}
/// Adds a key-value pair to `environment_variables`.
///
/// To override the contents of this collection use [`set_environment_variables`](Self::set_environment_variables).
///
/// <p> The environment variables map for an Amplify app. </p>
pub fn environment_variables(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.environment_variables.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.environment_variables = Some(hash_map);
self
}
/// <p> The environment variables map for an Amplify app. </p>
pub fn set_environment_variables(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.environment_variables = input;
self
}
/// <p> Enables the auto building of branches for an Amplify app. </p>
pub fn enable_branch_auto_build(mut self, input: bool) -> Self {
self.enable_branch_auto_build = Some(input);
self
}
/// <p> Enables the auto building of branches for an Amplify app. </p>
pub fn set_enable_branch_auto_build(mut self, input: std::option::Option<bool>) -> Self {
self.enable_branch_auto_build = input;
self
}
/// <p> Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. </p>
pub fn enable_branch_auto_deletion(mut self, input: bool) -> Self {
self.enable_branch_auto_deletion = Some(input);
self
}
/// <p> Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. </p>
pub fn set_enable_branch_auto_deletion(mut self, input: std::option::Option<bool>) -> Self {
self.enable_branch_auto_deletion = input;
self
}
/// <p> Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. </p>
pub fn enable_basic_auth(mut self, input: bool) -> Self {
self.enable_basic_auth = Some(input);
self
}
/// <p> Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. </p>
pub fn set_enable_basic_auth(mut self, input: std::option::Option<bool>) -> Self {
self.enable_basic_auth = input;
self
}
/// <p> The credentials for basic authorization for an Amplify app. You must base64-encode the authorization credentials and provide them in the format <code>user:password</code>.</p>
pub fn basic_auth_credentials(mut self, input: impl Into<std::string::String>) -> Self {
self.basic_auth_credentials = Some(input.into());
self
}
/// <p> The credentials for basic authorization for an Amplify app. You must base64-encode the authorization credentials and provide them in the format <code>user:password</code>.</p>
pub fn set_basic_auth_credentials(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.basic_auth_credentials = input;
self
}
/// Appends an item to `custom_rules`.
///
/// To override the contents of this collection use [`set_custom_rules`](Self::set_custom_rules).
///
/// <p> The custom rewrite and redirect rules for an Amplify app. </p>
pub fn custom_rules(mut self, input: crate::model::CustomRule) -> Self {
let mut v = self.custom_rules.unwrap_or_default();
v.push(input);
self.custom_rules = Some(v);
self
}
/// <p> The custom rewrite and redirect rules for an Amplify app. </p>
pub fn set_custom_rules(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::CustomRule>>,
) -> Self {
self.custom_rules = input;
self
}
/// Adds a key-value pair to `tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// <p> The tag for an Amplify app. </p>
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
/// <p> The tag for an Amplify app. </p>
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
/// <p> The build specification (build spec) for an Amplify app. </p>
pub fn build_spec(mut self, input: impl Into<std::string::String>) -> Self {
self.build_spec = Some(input.into());
self
}
/// <p> The build specification (build spec) for an Amplify app. </p>
pub fn set_build_spec(mut self, input: std::option::Option<std::string::String>) -> Self {
self.build_spec = input;
self
}
/// <p>The custom HTTP headers for an Amplify app.</p>
pub fn custom_headers(mut self, input: impl Into<std::string::String>) -> Self {
self.custom_headers = Some(input.into());
self
}
/// <p>The custom HTTP headers for an Amplify app.</p>
pub fn set_custom_headers(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.custom_headers = input;
self
}
/// <p> Enables automated branch creation for an Amplify app. </p>
pub fn enable_auto_branch_creation(mut self, input: bool) -> Self {
self.enable_auto_branch_creation = Some(input);
self
}
/// <p> Enables automated branch creation for an Amplify app. </p>
pub fn set_enable_auto_branch_creation(mut self, input: std::option::Option<bool>) -> Self {
self.enable_auto_branch_creation = input;
self
}
/// Appends an item to `auto_branch_creation_patterns`.
///
/// To override the contents of this collection use [`set_auto_branch_creation_patterns`](Self::set_auto_branch_creation_patterns).
///
/// <p> The automated branch creation glob patterns for an Amplify app. </p>
pub fn auto_branch_creation_patterns(
mut self,
input: impl Into<std::string::String>,
) -> Self {
let mut v = self.auto_branch_creation_patterns.unwrap_or_default();
v.push(input.into());
self.auto_branch_creation_patterns = Some(v);
self
}
/// <p> The automated branch creation glob patterns for an Amplify app. </p>
pub fn set_auto_branch_creation_patterns(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.auto_branch_creation_patterns = input;
self
}
/// <p> The automated branch creation configuration for an Amplify app. </p>
pub fn auto_branch_creation_config(
mut self,
input: crate::model::AutoBranchCreationConfig,
) -> Self {
self.auto_branch_creation_config = Some(input);
self
}
/// <p> The automated branch creation configuration for an Amplify app. </p>
pub fn set_auto_branch_creation_config(
mut self,
input: std::option::Option<crate::model::AutoBranchCreationConfig>,
) -> Self {
self.auto_branch_creation_config = input;
self
}
/// Consumes the builder and constructs a [`CreateAppInput`](crate::input::CreateAppInput)
pub fn build(
self,
) -> std::result::Result<crate::input::CreateAppInput, aws_smithy_http::operation::BuildError>
{
Ok(crate::input::CreateAppInput {
name: self.name,
description: self.description,
repository: self.repository,
platform: self.platform,
iam_service_role_arn: self.iam_service_role_arn,
oauth_token: self.oauth_token,
access_token: self.access_token,
environment_variables: self.environment_variables,
enable_branch_auto_build: self.enable_branch_auto_build,
enable_branch_auto_deletion: self.enable_branch_auto_deletion,
enable_basic_auth: self.enable_basic_auth,
basic_auth_credentials: self.basic_auth_credentials,
custom_rules: self.custom_rules,
tags: self.tags,
build_spec: self.build_spec,
custom_headers: self.custom_headers,
enable_auto_branch_creation: self.enable_auto_branch_creation,
auto_branch_creation_patterns: self.auto_branch_creation_patterns,
auto_branch_creation_config: self.auto_branch_creation_config,
})
}
}
}
#[doc(hidden)]
pub type CreateAppInputOperationOutputAlias = crate::operation::CreateApp;
#[doc(hidden)]
pub type CreateAppInputOperationRetryAlias = aws_http::retry::AwsErrorRetryPolicy;
impl CreateAppInput {
/// Consumes the builder and constructs an Operation<[`CreateApp`](crate::operation::CreateApp)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateApp,
aws_http::retry::AwsErrorRetryPolicy,
>,
aws_smithy_http::operation::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::CreateAppInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::BuildError> {
write!(output, "/apps").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateAppInput,
builder: http::request::Builder,
) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
{
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_create_app(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
aws_endpoint::set_endpoint_resolver(
&mut request.properties_mut(),
_config.endpoint_resolver.clone(),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::CreateApp::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateApp",
"amplify",
));
let op = op.with_retry_policy(aws_http::retry::AwsErrorRetryPolicy::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`CreateAppInput`](crate::input::CreateAppInput)
pub fn builder() -> crate::input::create_app_input::Builder {
crate::input::create_app_input::Builder::default()
}
}
/// See [`CreateBackendEnvironmentInput`](crate::input::CreateBackendEnvironmentInput)
pub mod create_backend_environment_input {
/// A builder for [`CreateBackendEnvironmentInput`](crate::input::CreateBackendEnvironmentInput)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) app_id: std::option::Option<std::string::String>,
pub(crate) environment_name: std::option::Option<std::string::String>,
pub(crate) stack_name: std::option::Option<std::string::String>,
pub(crate) deployment_artifacts: std::option::Option<std::string::String>,
}
impl Builder {
/// <p> The unique ID for an Amplify app. </p>
pub fn app_id(mut self, input: impl Into<std::string::String>) -> Self {
self.app_id = Some(input.into());
self
}
/// <p> The unique ID for an Amplify app. </p>
pub fn set_app_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.app_id = input;
self
}
/// <p> The name for the backend environment. </p>
pub fn environment_name(mut self, input: impl Into<std::string::String>) -> Self {
self.environment_name = Some(input.into());
self
}
/// <p> The name for the backend environment. </p>
pub fn set_environment_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.environment_name = input;
self
}
/// <p> The AWS CloudFormation stack name of a backend environment. </p>
pub fn stack_name(mut self, input: impl Into<std::string::String>) -> Self {
self.stack_name = Some(input.into());
self
}
/// <p> The AWS CloudFormation stack name of a backend environment. </p>
pub fn set_stack_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.stack_name = input;
self
}
/// <p> The name of deployment artifacts. </p>
pub fn deployment_artifacts(mut self, input: impl Into<std::string::String>) -> Self {
self.deployment_artifacts = Some(input.into());
self
}
/// <p> The name of deployment artifacts. </p>
pub fn set_deployment_artifacts(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.deployment_artifacts = input;
self
}
/// Consumes the builder and constructs a [`CreateBackendEnvironmentInput`](crate::input::CreateBackendEnvironmentInput)
pub fn build(
self,
) -> std::result::Result<
crate::input::CreateBackendEnvironmentInput,
aws_smithy_http::operation::BuildError,
> {
Ok(crate::input::CreateBackendEnvironmentInput {
app_id: self.app_id,
environment_name: self.environment_name,
stack_name: self.stack_name,
deployment_artifacts: self.deployment_artifacts,
})
}
}
}
#[doc(hidden)]
pub type CreateBackendEnvironmentInputOperationOutputAlias =
crate::operation::CreateBackendEnvironment;
#[doc(hidden)]
pub type CreateBackendEnvironmentInputOperationRetryAlias = aws_http::retry::AwsErrorRetryPolicy;
impl CreateBackendEnvironmentInput {
/// Consumes the builder and constructs an Operation<[`CreateBackendEnvironment`](crate::operation::CreateBackendEnvironment)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateBackendEnvironment,
aws_http::retry::AwsErrorRetryPolicy,
>,
aws_smithy_http::operation::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::CreateBackendEnvironmentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::BuildError> {
let input_1 = &_input.app_id;
let input_1 = input_1.as_ref().ok_or(
aws_smithy_http::operation::BuildError::MissingField {
field: "app_id",
details: "cannot be empty or unset",
},
)?;
let app_id = aws_smithy_http::label::fmt_string(input_1, false);
if app_id.is_empty() {
return Err(aws_smithy_http::operation::BuildError::MissingField {
field: "app_id",
details: "cannot be empty or unset",
});
}
write!(output, "/apps/{appId}/backendenvironments", appId = app_id)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateBackendEnvironmentInput,
builder: http::request::Builder,
) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
{
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_create_backend_environment(
&self,
)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
aws_endpoint::set_endpoint_resolver(
&mut request.properties_mut(),
_config.endpoint_resolver.clone(),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::CreateBackendEnvironment::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateBackendEnvironment",
"amplify",
));
let op = op.with_retry_policy(aws_http::retry::AwsErrorRetryPolicy::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`CreateBackendEnvironmentInput`](crate::input::CreateBackendEnvironmentInput)
pub fn builder() -> crate::input::create_backend_environment_input::Builder {
crate::input::create_backend_environment_input::Builder::default()
}
}
/// See [`CreateBranchInput`](crate::input::CreateBranchInput)
pub mod create_branch_input {
/// A builder for [`CreateBranchInput`](crate::input::CreateBranchInput)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) app_id: std::option::Option<std::string::String>,
pub(crate) branch_name: std::option::Option<std::string::String>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) stage: std::option::Option<crate::model::Stage>,
pub(crate) framework: std::option::Option<std::string::String>,
pub(crate) enable_notification: std::option::Option<bool>,
pub(crate) enable_auto_build: std::option::Option<bool>,
pub(crate) environment_variables: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) basic_auth_credentials: std::option::Option<std::string::String>,
pub(crate) enable_basic_auth: std::option::Option<bool>,
pub(crate) enable_performance_mode: std::option::Option<bool>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) build_spec: std::option::Option<std::string::String>,
pub(crate) ttl: std::option::Option<std::string::String>,
pub(crate) display_name: std::option::Option<std::string::String>,
pub(crate) enable_pull_request_preview: std::option::Option<bool>,
pub(crate) pull_request_environment_name: std::option::Option<std::string::String>,
pub(crate) backend_environment_arn: std::option::Option<std::string::String>,
}
impl Builder {
/// <p> The unique ID for an Amplify app. </p>
pub fn app_id(mut self, input: impl Into<std::string::String>) -> Self {
self.app_id = Some(input.into());
self
}
/// <p> The unique ID for an Amplify app. </p>
pub fn set_app_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.app_id = input;
self
}
/// <p> The name for the branch. </p>
pub fn branch_name(mut self, input: impl Into<std::string::String>) -> Self {
self.branch_name = Some(input.into());
self
}
/// <p> The name for the branch. </p>
pub fn set_branch_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.branch_name = input;
self
}
/// <p> The description for the branch. </p>
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
/// <p> The description for the branch. </p>
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
/// <p> Describes the current stage for the branch. </p>
pub fn stage(mut self, input: crate::model::Stage) -> Self {
self.stage = Some(input);
self
}
/// <p> Describes the current stage for the branch. </p>
pub fn set_stage(mut self, input: std::option::Option<crate::model::Stage>) -> Self {
self.stage = input;
self
}
/// <p> The framework for the branch. </p>
pub fn framework(mut self, input: impl Into<std::string::String>) -> Self {
self.framework = Some(input.into());
self
}
/// <p> The framework for the branch. </p>
pub fn set_framework(mut self, input: std::option::Option<std::string::String>) -> Self {
self.framework = input;
self
}
/// <p> Enables notifications for the branch. </p>
pub fn enable_notification(mut self, input: bool) -> Self {
self.enable_notification = Some(input);
self
}
/// <p> Enables notifications for the branch. </p>
pub fn set_enable_notification(mut self, input: std::option::Option<bool>) -> Self {
self.enable_notification = input;
self
}
/// <p> Enables auto building for the branch. </p>
pub fn enable_auto_build(mut self, input: bool) -> Self {
self.enable_auto_build = Some(input);
self
}
/// <p> Enables auto building for the branch. </p>
pub fn set_enable_auto_build(mut self, input: std::option::Option<bool>) -> Self {
self.enable_auto_build = input;
self
}
/// Adds a key-value pair to `environment_variables`.
///
/// To override the contents of this collection use [`set_environment_variables`](Self::set_environment_variables).
///
/// <p> The environment variables for the branch. </p>
pub fn environment_variables(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.environment_variables.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.environment_variables = Some(hash_map);
self
}
/// <p> The environment variables for the branch. </p>
pub fn set_environment_variables(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.environment_variables = input;
self
}
/// <p> The basic authorization credentials for the branch. You must base64-encode the authorization credentials and provide them in the format <code>user:password</code>.</p>
pub fn basic_auth_credentials(mut self, input: impl Into<std::string::String>) -> Self {
self.basic_auth_credentials = Some(input.into());
self
}
/// <p> The basic authorization credentials for the branch. You must base64-encode the authorization credentials and provide them in the format <code>user:password</code>.</p>
pub fn set_basic_auth_credentials(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.basic_auth_credentials = input;
self
}
/// <p> Enables basic authorization for the branch. </p>
pub fn enable_basic_auth(mut self, input: bool) -> Self {
self.enable_basic_auth = Some(input);
self
}
/// <p> Enables basic authorization for the branch. </p>
pub fn set_enable_basic_auth(mut self, input: std::option::Option<bool>) -> Self {
self.enable_basic_auth = input;
self
}
/// <p>Enables performance mode for the branch.</p>
/// <p>Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out. </p>
pub fn enable_performance_mode(mut self, input: bool) -> Self {
self.enable_performance_mode = Some(input);
self
}
/// <p>Enables performance mode for the branch.</p>
/// <p>Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out. </p>
pub fn set_enable_performance_mode(mut self, input: std::option::Option<bool>) -> Self {
self.enable_performance_mode = input;
self
}
/// Adds a key-value pair to `tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// <p> The tag for the branch. </p>
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
/// <p> The tag for the branch. </p>
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
/// <p> The build specification (build spec) for the branch. </p>
pub fn build_spec(mut self, input: impl Into<std::string::String>) -> Self {
self.build_spec = Some(input.into());
self
}
/// <p> The build specification (build spec) for the branch. </p>
pub fn set_build_spec(mut self, input: std::option::Option<std::string::String>) -> Self {
self.build_spec = input;
self
}
/// <p> The content Time To Live (TTL) for the website in seconds. </p>
pub fn ttl(mut self, input: impl Into<std::string::String>) -> Self {
self.ttl = Some(input.into());
self
}
/// <p> The content Time To Live (TTL) for the website in seconds. </p>
pub fn set_ttl(mut self, input: std::option::Option<std::string::String>) -> Self {
self.ttl = input;
self
}
/// <p> The display name for a branch. This is used as the default domain prefix. </p>
pub fn display_name(mut self, input: impl Into<std::string::String>) -> Self {
self.display_name = Some(input.into());
self
}
/// <p> The display name for a branch. This is used as the default domain prefix. </p>
pub fn set_display_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.display_name = input;
self
}
/// <p> Enables pull request previews for this branch. </p>
pub fn enable_pull_request_preview(mut self, input: bool) -> Self {
self.enable_pull_request_preview = Some(input);
self
}
/// <p> Enables pull request previews for this branch. </p>
pub fn set_enable_pull_request_preview(mut self, input: std::option::Option<bool>) -> Self {
self.enable_pull_request_preview = input;
self
}
/// <p> The Amplify environment name for the pull request. </p>
pub fn pull_request_environment_name(
mut self,
input: impl Into<std::string::String>,
) -> Self {
self.pull_request_environment_name = Some(input.into());
self
}
/// <p> The Amplify environment name for the pull request. </p>
pub fn set_pull_request_environment_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.pull_request_environment_name = input;
self
}
/// <p> The Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app. </p>
pub fn backend_environment_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.backend_environment_arn = Some(input.into());
self
}
/// <p> The Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app. </p>
pub fn set_backend_environment_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.backend_environment_arn = input;
self
}
/// Consumes the builder and constructs a [`CreateBranchInput`](crate::input::CreateBranchInput)
pub fn build(
self,
) -> std::result::Result<
crate::input::CreateBranchInput,
aws_smithy_http::operation::BuildError,
> {
Ok(crate::input::CreateBranchInput {
app_id: self.app_id,
branch_name: self.branch_name,
description: self.description,
stage: self.stage,
framework: self.framework,
enable_notification: self.enable_notification,
enable_auto_build: self.enable_auto_build,
environment_variables: self.environment_variables,
basic_auth_credentials: self.basic_auth_credentials,
enable_basic_auth: self.enable_basic_auth,
enable_performance_mode: self.enable_performance_mode,
tags: self.tags,
build_spec: self.build_spec,
ttl: self.ttl,
display_name: self.display_name,
enable_pull_request_preview: self.enable_pull_request_preview,
pull_request_environment_name: self.pull_request_environment_name,
backend_environment_arn: self.backend_environment_arn,
})
}
}
}
#[doc(hidden)]
pub type CreateBranchInputOperationOutputAlias = crate::operation::CreateBranch;
#[doc(hidden)]
pub type CreateBranchInputOperationRetryAlias = aws_http::retry::AwsErrorRetryPolicy;
impl CreateBranchInput {
/// Consumes the builder and constructs an Operation<[`CreateBranch`](crate::operation::CreateBranch)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateBranch,
aws_http::retry::AwsErrorRetryPolicy,
>,
aws_smithy_http::operation::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::CreateBranchInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::BuildError> {
let input_2 = &_input.app_id;
let input_2 = input_2.as_ref().ok_or(
aws_smithy_http::operation::BuildError::MissingField {
field: "app_id",
details: "cannot be empty or unset",
},
)?;
let app_id = aws_smithy_http::label::fmt_string(input_2, false);
if app_id.is_empty() {
return Err(aws_smithy_http::operation::BuildError::MissingField {
field: "app_id",
details: "cannot be empty or unset",
});
}
write!(output, "/apps/{appId}/branches", appId = app_id)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateBranchInput,
builder: http::request::Builder,
) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
{
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_create_branch(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
aws_endpoint::set_endpoint_resolver(
&mut request.properties_mut(),
_config.endpoint_resolver.clone(),
);