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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate lazy_static;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
/// Home office and physical location of the principal.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessLocations {
/// The "home office" location of the principal. A two-letter country code
/// (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some
/// limited situations Google systems may refer refer to a region code instead
/// of a country code.
/// Possible Region Codes:
///
/// * ASI: Asia
/// * EUR: Europe
/// * OCE: Oceania
/// * AFR: Africa
/// * NAM: North America
/// * SAM: South America
/// * ANT: Antarctica
/// * ANY: Any location
pub principal_office_country: std::string::String,
/// Physical location of the principal at the time of the access. A
/// two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or
/// a region code. In some limited situations Google systems may refer refer to
/// a region code instead of a country code.
/// Possible Region Codes:
///
/// * ASI: Asia
/// * EUR: Europe
/// * OCE: Oceania
/// * AFR: Africa
/// * NAM: North America
/// * SAM: South America
/// * ANT: Antarctica
/// * ANY: Any location
pub principal_physical_location_country: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessLocations {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [principal_office_country][crate::model::AccessLocations::principal_office_country].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessLocations;
/// let x = AccessLocations::new().set_principal_office_country("example");
/// ```
pub fn set_principal_office_country<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.principal_office_country = v.into();
self
}
/// Sets the value of [principal_physical_location_country][crate::model::AccessLocations::principal_physical_location_country].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessLocations;
/// let x = AccessLocations::new().set_principal_physical_location_country("example");
/// ```
pub fn set_principal_physical_location_country<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.principal_physical_location_country = v.into();
self
}
}
impl wkt::message::Message for AccessLocations {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.AccessLocations"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessReason {
/// Type of access justification.
pub r#type: crate::model::access_reason::Type,
/// More detail about certain reason types. See comments for each type above.
pub detail: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessReason {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::AccessReason::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessReason;
/// use google_cloud_accessapproval_v1::model::access_reason::Type;
/// let x0 = AccessReason::new().set_type(Type::CustomerInitiatedSupport);
/// let x1 = AccessReason::new().set_type(Type::GoogleInitiatedService);
/// let x2 = AccessReason::new().set_type(Type::GoogleInitiatedReview);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::access_reason::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [detail][crate::model::AccessReason::detail].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessReason;
/// let x = AccessReason::new().set_detail("example");
/// ```
pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.detail = v.into();
self
}
}
impl wkt::message::Message for AccessReason {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.AccessReason"
}
}
/// Defines additional types related to [AccessReason].
pub mod access_reason {
#[allow(unused_imports)]
use super::*;
/// Type of access justification.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Default value for proto, shouldn't be used.
Unspecified,
/// Customer made a request or raised an issue that required the principal to
/// access customer data. `detail` is of the form ("#####" is the issue ID):
///
/// * "Feedback Report: #####"
/// * "Case Number: #####"
/// * "Case ID: #####"
/// * "E-PIN Reference: #####"
/// * "Google-#####"
/// * "T-#####"
CustomerInitiatedSupport,
/// The principal accessed customer data in order to diagnose or resolve a
/// suspected issue in services. Often this access is used to confirm that
/// customers are not affected by a suspected service issue or to remediate a
/// reversible system issue.
GoogleInitiatedService,
/// Google initiated service for security, fraud, abuse, or compliance
/// purposes.
GoogleInitiatedReview,
/// The principal was compelled to access customer data in order to respond
/// to a legal third party data request or process, including legal processes
/// from customers themselves.
ThirdPartyDataRequest,
/// The principal accessed customer data in order to diagnose or resolve a
/// suspected issue in services or a known outage.
GoogleResponseToProductionAlert,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::CustomerInitiatedSupport => std::option::Option::Some(1),
Self::GoogleInitiatedService => std::option::Option::Some(2),
Self::GoogleInitiatedReview => std::option::Option::Some(3),
Self::ThirdPartyDataRequest => std::option::Option::Some(4),
Self::GoogleResponseToProductionAlert => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::CustomerInitiatedSupport => {
std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
}
Self::GoogleInitiatedService => {
std::option::Option::Some("GOOGLE_INITIATED_SERVICE")
}
Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
Self::ThirdPartyDataRequest => {
std::option::Option::Some("THIRD_PARTY_DATA_REQUEST")
}
Self::GoogleResponseToProductionAlert => {
std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::CustomerInitiatedSupport,
2 => Self::GoogleInitiatedService,
3 => Self::GoogleInitiatedReview,
4 => Self::ThirdPartyDataRequest,
5 => Self::GoogleResponseToProductionAlert,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
"GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
"GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
"THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
"GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Type {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
Self::GoogleInitiatedService => serializer.serialize_i32(2),
Self::GoogleInitiatedReview => serializer.serialize_i32(3),
Self::ThirdPartyDataRequest => serializer.serialize_i32(4),
Self::GoogleResponseToProductionAlert => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Type {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
".google.cloud.accessapproval.v1.AccessReason.Type",
))
}
}
}
/// Information about the digital signature of the resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SignatureInfo {
/// The digital signature.
pub signature: ::bytes::Bytes,
/// How this signature may be verified.
pub verification_info: std::option::Option<crate::model::signature_info::VerificationInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SignatureInfo {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [signature][crate::model::SignatureInfo::signature].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::SignatureInfo;
/// let x = SignatureInfo::new().set_signature(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.signature = v.into();
self
}
/// Sets the value of [verification_info][crate::model::SignatureInfo::verification_info].
///
/// Note that all the setters affecting `verification_info` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::SignatureInfo;
/// use google_cloud_accessapproval_v1::model::signature_info::VerificationInfo;
/// let x = SignatureInfo::new().set_verification_info(Some(VerificationInfo::GooglePublicKeyPem("example".to_string())));
/// ```
pub fn set_verification_info<
T: std::convert::Into<std::option::Option<crate::model::signature_info::VerificationInfo>>,
>(
mut self,
v: T,
) -> Self {
self.verification_info = v.into();
self
}
/// The value of [verification_info][crate::model::SignatureInfo::verification_info]
/// if it holds a `GooglePublicKeyPem`, `None` if the field is not set or
/// holds a different branch.
pub fn google_public_key_pem(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.verification_info.as_ref().and_then(|v| match v {
crate::model::signature_info::VerificationInfo::GooglePublicKeyPem(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [verification_info][crate::model::SignatureInfo::verification_info]
/// to hold a `GooglePublicKeyPem`.
///
/// Note that all the setters affecting `verification_info` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::SignatureInfo;
/// let x = SignatureInfo::new().set_google_public_key_pem("example");
/// assert!(x.google_public_key_pem().is_some());
/// assert!(x.customer_kms_key_version().is_none());
/// ```
pub fn set_google_public_key_pem<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.verification_info = std::option::Option::Some(
crate::model::signature_info::VerificationInfo::GooglePublicKeyPem(v.into()),
);
self
}
/// The value of [verification_info][crate::model::SignatureInfo::verification_info]
/// if it holds a `CustomerKmsKeyVersion`, `None` if the field is not set or
/// holds a different branch.
pub fn customer_kms_key_version(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.verification_info.as_ref().and_then(|v| match v {
crate::model::signature_info::VerificationInfo::CustomerKmsKeyVersion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [verification_info][crate::model::SignatureInfo::verification_info]
/// to hold a `CustomerKmsKeyVersion`.
///
/// Note that all the setters affecting `verification_info` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::SignatureInfo;
/// let x = SignatureInfo::new().set_customer_kms_key_version("example");
/// assert!(x.customer_kms_key_version().is_some());
/// assert!(x.google_public_key_pem().is_none());
/// ```
pub fn set_customer_kms_key_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.verification_info = std::option::Option::Some(
crate::model::signature_info::VerificationInfo::CustomerKmsKeyVersion(v.into()),
);
self
}
}
impl wkt::message::Message for SignatureInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.SignatureInfo"
}
}
/// Defines additional types related to [SignatureInfo].
pub mod signature_info {
#[allow(unused_imports)]
use super::*;
/// How this signature may be verified.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum VerificationInfo {
/// The public key for the Google default signing, encoded in PEM format. The
/// signature was created using a private key which may be verified using
/// this public key.
GooglePublicKeyPem(std::string::String),
/// The resource name of the customer CryptoKeyVersion used for signing.
CustomerKmsKeyVersion(std::string::String),
}
}
/// A decision that has been made to approve access to a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApproveDecision {
/// The time at which approval was granted.
pub approve_time: std::option::Option<wkt::Timestamp>,
/// The time at which the approval expires.
pub expire_time: std::option::Option<wkt::Timestamp>,
/// If set, denotes the timestamp at which the approval is invalidated.
pub invalidate_time: std::option::Option<wkt::Timestamp>,
/// The signature for the ApprovalRequest and details on how it was signed.
pub signature_info: std::option::Option<crate::model::SignatureInfo>,
/// True when the request has been auto-approved.
pub auto_approved: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ApproveDecision {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [approve_time][crate::model::ApproveDecision::approve_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_approve_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_approve_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.approve_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [approve_time][crate::model::ApproveDecision::approve_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_or_clear_approve_time(Some(Timestamp::default()/* use setters */));
/// let x = ApproveDecision::new().set_or_clear_approve_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_approve_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.approve_time = v.map(|x| x.into());
self
}
/// Sets the value of [expire_time][crate::model::ApproveDecision::expire_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_expire_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [expire_time][crate::model::ApproveDecision::expire_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
/// let x = ApproveDecision::new().set_or_clear_expire_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = v.map(|x| x.into());
self
}
/// Sets the value of [invalidate_time][crate::model::ApproveDecision::invalidate_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_invalidate_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_invalidate_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.invalidate_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [invalidate_time][crate::model::ApproveDecision::invalidate_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use wkt::Timestamp;
/// let x = ApproveDecision::new().set_or_clear_invalidate_time(Some(Timestamp::default()/* use setters */));
/// let x = ApproveDecision::new().set_or_clear_invalidate_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_invalidate_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.invalidate_time = v.map(|x| x.into());
self
}
/// Sets the value of [signature_info][crate::model::ApproveDecision::signature_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use google_cloud_accessapproval_v1::model::SignatureInfo;
/// let x = ApproveDecision::new().set_signature_info(SignatureInfo::default()/* use setters */);
/// ```
pub fn set_signature_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SignatureInfo>,
{
self.signature_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [signature_info][crate::model::ApproveDecision::signature_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// use google_cloud_accessapproval_v1::model::SignatureInfo;
/// let x = ApproveDecision::new().set_or_clear_signature_info(Some(SignatureInfo::default()/* use setters */));
/// let x = ApproveDecision::new().set_or_clear_signature_info(None::<SignatureInfo>);
/// ```
pub fn set_or_clear_signature_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SignatureInfo>,
{
self.signature_info = v.map(|x| x.into());
self
}
/// Sets the value of [auto_approved][crate::model::ApproveDecision::auto_approved].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveDecision;
/// let x = ApproveDecision::new().set_auto_approved(true);
/// ```
pub fn set_auto_approved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.auto_approved = v.into();
self
}
}
impl wkt::message::Message for ApproveDecision {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ApproveDecision"
}
}
/// A decision that has been made to dismiss an approval request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DismissDecision {
/// The time at which the approval request was dismissed.
pub dismiss_time: std::option::Option<wkt::Timestamp>,
/// This field will be true if the ApprovalRequest was implicitly dismissed due
/// to inaction by the access approval approvers (the request is not acted
/// on by the approvers before the exiration time).
pub implicit: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DismissDecision {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dismiss_time][crate::model::DismissDecision::dismiss_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::DismissDecision;
/// use wkt::Timestamp;
/// let x = DismissDecision::new().set_dismiss_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_dismiss_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.dismiss_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dismiss_time][crate::model::DismissDecision::dismiss_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::DismissDecision;
/// use wkt::Timestamp;
/// let x = DismissDecision::new().set_or_clear_dismiss_time(Some(Timestamp::default()/* use setters */));
/// let x = DismissDecision::new().set_or_clear_dismiss_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_dismiss_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.dismiss_time = v.map(|x| x.into());
self
}
/// Sets the value of [implicit][crate::model::DismissDecision::implicit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::DismissDecision;
/// let x = DismissDecision::new().set_implicit(true);
/// ```
pub fn set_implicit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.implicit = v.into();
self
}
}
impl wkt::message::Message for DismissDecision {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.DismissDecision"
}
}
/// The properties associated with the resource of the request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceProperties {
/// Whether an approval will exclude the descendants of the resource being
/// requested.
pub excludes_descendants: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResourceProperties {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [excludes_descendants][crate::model::ResourceProperties::excludes_descendants].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ResourceProperties;
/// let x = ResourceProperties::new().set_excludes_descendants(true);
/// ```
pub fn set_excludes_descendants<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.excludes_descendants = v.into();
self
}
}
impl wkt::message::Message for ResourceProperties {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ResourceProperties"
}
}
/// A request for the customer to approve access to a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApprovalRequest {
/// The resource name of the request. Format is
/// "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}".
pub name: std::string::String,
/// The resource for which approval is being requested. The format of the
/// resource name is defined at
/// <https://cloud.google.com/apis/design/resource_names>. The resource name here
/// may either be a "full" resource name (e.g.
/// "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative"
/// resource name (e.g. "shelves/shelf1/books/book2") as described in the
/// resource name specification.
pub requested_resource_name: std::string::String,
/// Properties related to the resource represented by requested_resource_name.
pub requested_resource_properties: std::option::Option<crate::model::ResourceProperties>,
/// The justification for which approval is being requested.
pub requested_reason: std::option::Option<crate::model::AccessReason>,
/// The locations for which approval is being requested.
pub requested_locations: std::option::Option<crate::model::AccessLocations>,
/// The time at which approval was requested.
pub request_time: std::option::Option<wkt::Timestamp>,
/// The requested expiration for the approval. If the request is approved,
/// access will be granted from the time of approval until the expiration time.
pub requested_expiration: std::option::Option<wkt::Timestamp>,
/// The current decision on the approval request.
pub decision: std::option::Option<crate::model::approval_request::Decision>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ApprovalRequest {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ApprovalRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// let x = ApprovalRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [requested_resource_name][crate::model::ApprovalRequest::requested_resource_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// let x = ApprovalRequest::new().set_requested_resource_name("example");
/// ```
pub fn set_requested_resource_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.requested_resource_name = v.into();
self
}
/// Sets the value of [requested_resource_properties][crate::model::ApprovalRequest::requested_resource_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::ResourceProperties;
/// let x = ApprovalRequest::new().set_requested_resource_properties(ResourceProperties::default()/* use setters */);
/// ```
pub fn set_requested_resource_properties<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ResourceProperties>,
{
self.requested_resource_properties = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [requested_resource_properties][crate::model::ApprovalRequest::requested_resource_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::ResourceProperties;
/// let x = ApprovalRequest::new().set_or_clear_requested_resource_properties(Some(ResourceProperties::default()/* use setters */));
/// let x = ApprovalRequest::new().set_or_clear_requested_resource_properties(None::<ResourceProperties>);
/// ```
pub fn set_or_clear_requested_resource_properties<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ResourceProperties>,
{
self.requested_resource_properties = v.map(|x| x.into());
self
}
/// Sets the value of [requested_reason][crate::model::ApprovalRequest::requested_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::AccessReason;
/// let x = ApprovalRequest::new().set_requested_reason(AccessReason::default()/* use setters */);
/// ```
pub fn set_requested_reason<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AccessReason>,
{
self.requested_reason = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [requested_reason][crate::model::ApprovalRequest::requested_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::AccessReason;
/// let x = ApprovalRequest::new().set_or_clear_requested_reason(Some(AccessReason::default()/* use setters */));
/// let x = ApprovalRequest::new().set_or_clear_requested_reason(None::<AccessReason>);
/// ```
pub fn set_or_clear_requested_reason<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AccessReason>,
{
self.requested_reason = v.map(|x| x.into());
self
}
/// Sets the value of [requested_locations][crate::model::ApprovalRequest::requested_locations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::AccessLocations;
/// let x = ApprovalRequest::new().set_requested_locations(AccessLocations::default()/* use setters */);
/// ```
pub fn set_requested_locations<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AccessLocations>,
{
self.requested_locations = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [requested_locations][crate::model::ApprovalRequest::requested_locations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::AccessLocations;
/// let x = ApprovalRequest::new().set_or_clear_requested_locations(Some(AccessLocations::default()/* use setters */));
/// let x = ApprovalRequest::new().set_or_clear_requested_locations(None::<AccessLocations>);
/// ```
pub fn set_or_clear_requested_locations<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AccessLocations>,
{
self.requested_locations = v.map(|x| x.into());
self
}
/// Sets the value of [request_time][crate::model::ApprovalRequest::request_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use wkt::Timestamp;
/// let x = ApprovalRequest::new().set_request_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_request_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.request_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [request_time][crate::model::ApprovalRequest::request_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use wkt::Timestamp;
/// let x = ApprovalRequest::new().set_or_clear_request_time(Some(Timestamp::default()/* use setters */));
/// let x = ApprovalRequest::new().set_or_clear_request_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_request_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.request_time = v.map(|x| x.into());
self
}
/// Sets the value of [requested_expiration][crate::model::ApprovalRequest::requested_expiration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use wkt::Timestamp;
/// let x = ApprovalRequest::new().set_requested_expiration(Timestamp::default()/* use setters */);
/// ```
pub fn set_requested_expiration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.requested_expiration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [requested_expiration][crate::model::ApprovalRequest::requested_expiration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use wkt::Timestamp;
/// let x = ApprovalRequest::new().set_or_clear_requested_expiration(Some(Timestamp::default()/* use setters */));
/// let x = ApprovalRequest::new().set_or_clear_requested_expiration(None::<Timestamp>);
/// ```
pub fn set_or_clear_requested_expiration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.requested_expiration = v.map(|x| x.into());
self
}
/// Sets the value of [decision][crate::model::ApprovalRequest::decision].
///
/// Note that all the setters affecting `decision` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::ApproveDecision;
/// let x = ApprovalRequest::new().set_decision(Some(
/// google_cloud_accessapproval_v1::model::approval_request::Decision::Approve(ApproveDecision::default().into())));
/// ```
pub fn set_decision<
T: std::convert::Into<std::option::Option<crate::model::approval_request::Decision>>,
>(
mut self,
v: T,
) -> Self {
self.decision = v.into();
self
}
/// The value of [decision][crate::model::ApprovalRequest::decision]
/// if it holds a `Approve`, `None` if the field is not set or
/// holds a different branch.
pub fn approve(&self) -> std::option::Option<&std::boxed::Box<crate::model::ApproveDecision>> {
#[allow(unreachable_patterns)]
self.decision.as_ref().and_then(|v| match v {
crate::model::approval_request::Decision::Approve(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [decision][crate::model::ApprovalRequest::decision]
/// to hold a `Approve`.
///
/// Note that all the setters affecting `decision` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::ApproveDecision;
/// let x = ApprovalRequest::new().set_approve(ApproveDecision::default()/* use setters */);
/// assert!(x.approve().is_some());
/// assert!(x.dismiss().is_none());
/// ```
pub fn set_approve<T: std::convert::Into<std::boxed::Box<crate::model::ApproveDecision>>>(
mut self,
v: T,
) -> Self {
self.decision =
std::option::Option::Some(crate::model::approval_request::Decision::Approve(v.into()));
self
}
/// The value of [decision][crate::model::ApprovalRequest::decision]
/// if it holds a `Dismiss`, `None` if the field is not set or
/// holds a different branch.
pub fn dismiss(&self) -> std::option::Option<&std::boxed::Box<crate::model::DismissDecision>> {
#[allow(unreachable_patterns)]
self.decision.as_ref().and_then(|v| match v {
crate::model::approval_request::Decision::Dismiss(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [decision][crate::model::ApprovalRequest::decision]
/// to hold a `Dismiss`.
///
/// Note that all the setters affecting `decision` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// use google_cloud_accessapproval_v1::model::DismissDecision;
/// let x = ApprovalRequest::new().set_dismiss(DismissDecision::default()/* use setters */);
/// assert!(x.dismiss().is_some());
/// assert!(x.approve().is_none());
/// ```
pub fn set_dismiss<T: std::convert::Into<std::boxed::Box<crate::model::DismissDecision>>>(
mut self,
v: T,
) -> Self {
self.decision =
std::option::Option::Some(crate::model::approval_request::Decision::Dismiss(v.into()));
self
}
}
impl wkt::message::Message for ApprovalRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ApprovalRequest"
}
}
/// Defines additional types related to [ApprovalRequest].
pub mod approval_request {
#[allow(unused_imports)]
use super::*;
/// The current decision on the approval request.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Decision {
/// Access was approved.
Approve(std::boxed::Box<crate::model::ApproveDecision>),
/// The request was dismissed.
Dismiss(std::boxed::Box<crate::model::DismissDecision>),
}
}
/// Represents the enrollment of a cloud resource into a specific service.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnrolledService {
/// The product for which Access Approval will be enrolled. Allowed values are
/// listed below (case-sensitive):
///
/// * all
/// * GA
/// * App Engine
/// * BigQuery
/// * Cloud Bigtable
/// * Cloud Key Management Service
/// * Compute Engine
/// * Cloud Dataflow
/// * Cloud Dataproc
/// * Cloud DLP
/// * Cloud EKM
/// * Cloud HSM
/// * Cloud Identity and Access Management
/// * Cloud Logging
/// * Cloud Pub/Sub
/// * Cloud Spanner
/// * Cloud SQL
/// * Cloud Storage
/// * Google Kubernetes Engine
/// * Organization Policy Serivice
/// * Persistent Disk
/// * Resource Manager
/// * Secret Manager
/// * Speaker ID
///
/// Note: These values are supported as input for legacy purposes, but will not
/// be returned from the API.
///
/// * all
/// * ga-only
/// * appengine.googleapis.com
/// * bigquery.googleapis.com
/// * bigtable.googleapis.com
/// * container.googleapis.com
/// * cloudkms.googleapis.com
/// * cloudresourcemanager.googleapis.com
/// * cloudsql.googleapis.com
/// * compute.googleapis.com
/// * dataflow.googleapis.com
/// * dataproc.googleapis.com
/// * dlp.googleapis.com
/// * iam.googleapis.com
/// * logging.googleapis.com
/// * orgpolicy.googleapis.com
/// * pubsub.googleapis.com
/// * spanner.googleapis.com
/// * secretmanager.googleapis.com
/// * speakerid.googleapis.com
/// * storage.googleapis.com
///
/// Calls to UpdateAccessApprovalSettings using 'all' or any of the
/// XXX.googleapis.com will be translated to the associated product name
/// ('all', 'App Engine', etc.).
///
/// Note: 'all' will enroll the resource in all products supported at both 'GA'
/// and 'Preview' levels.
///
/// More information about levels of support is available at
/// <https://cloud.google.com/access-approval/docs/supported-services>
pub cloud_product: std::string::String,
/// The enrollment level of the service.
pub enrollment_level: crate::model::EnrollmentLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EnrolledService {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [cloud_product][crate::model::EnrolledService::cloud_product].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::EnrolledService;
/// let x = EnrolledService::new().set_cloud_product("example");
/// ```
pub fn set_cloud_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cloud_product = v.into();
self
}
/// Sets the value of [enrollment_level][crate::model::EnrolledService::enrollment_level].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::EnrolledService;
/// use google_cloud_accessapproval_v1::model::EnrollmentLevel;
/// let x0 = EnrolledService::new().set_enrollment_level(EnrollmentLevel::BlockAll);
/// ```
pub fn set_enrollment_level<T: std::convert::Into<crate::model::EnrollmentLevel>>(
mut self,
v: T,
) -> Self {
self.enrollment_level = v.into();
self
}
}
impl wkt::message::Message for EnrolledService {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.EnrolledService"
}
}
/// Settings on a Project/Folder/Organization related to Access Approval.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessApprovalSettings {
/// The resource name of the settings. Format is one of:
///
/// * "projects/{project}/accessApprovalSettings"
/// * "folders/{folder}/accessApprovalSettings"
/// * "organizations/{organization}/accessApprovalSettings"
pub name: std::string::String,
/// A list of email addresses to which notifications relating to approval
/// requests should be sent. Notifications relating to a resource will be sent
/// to all emails in the settings of ancestor resources of that resource. A
/// maximum of 50 email addresses are allowed.
pub notification_emails: std::vec::Vec<std::string::String>,
/// A list of Google Cloud Services for which the given resource has Access
/// Approval enrolled. Access requests for the resource given by name against
/// any of these services contained here will be required to have explicit
/// approval. If name refers to an organization, enrollment can be done for
/// individual services. If name refers to a folder or project, enrollment can
/// only be done on an all or nothing basis.
///
/// If a cloud_product is repeated in this list, the first entry will be
/// honored and all following entries will be discarded. A maximum of 10
/// enrolled services will be enforced, to be expanded as the set of supported
/// services is expanded.
pub enrolled_services: std::vec::Vec<crate::model::EnrolledService>,
/// Output only. This field is read only (not settable via
/// UpdateAccessApprovalSettings method). If the field is true, that
/// indicates that at least one service is enrolled for Access Approval in one
/// or more ancestors of the Project or Folder (this field will always be
/// unset for the organization since organizations do not have ancestors).
pub enrolled_ancestor: bool,
/// The asymmetric crypto key version to use for signing approval requests.
/// Empty active_key_version indicates that a Google-managed key should be used
/// for signing. This property will be ignored if set by an ancestor of this
/// resource, and new non-empty values may not be set.
pub active_key_version: std::string::String,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings
/// method). If the field is true, that indicates that an ancestor of this
/// Project or Folder has set active_key_version (this field will always be
/// unset for the organization since organizations do not have ancestors).
pub ancestor_has_active_key_version: bool,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings
/// method). If the field is true, that indicates that there is some
/// configuration issue with the active_key_version configured at this level in
/// the resource hierarchy (e.g. it doesn't exist or the Access Approval
/// service account doesn't have the correct permissions on it, etc.) This key
/// version is not necessarily the effective key version at this level, as key
/// versions are inherited top-down.
pub invalid_key_version: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessApprovalSettings {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::AccessApprovalSettings::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [notification_emails][crate::model::AccessApprovalSettings::notification_emails].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_notification_emails(["a", "b", "c"]);
/// ```
pub fn set_notification_emails<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.notification_emails = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [enrolled_services][crate::model::AccessApprovalSettings::enrolled_services].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// use google_cloud_accessapproval_v1::model::EnrolledService;
/// let x = AccessApprovalSettings::new()
/// .set_enrolled_services([
/// EnrolledService::default()/* use setters */,
/// EnrolledService::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_enrolled_services<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EnrolledService>,
{
use std::iter::Iterator;
self.enrolled_services = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [enrolled_ancestor][crate::model::AccessApprovalSettings::enrolled_ancestor].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_enrolled_ancestor(true);
/// ```
pub fn set_enrolled_ancestor<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enrolled_ancestor = v.into();
self
}
/// Sets the value of [active_key_version][crate::model::AccessApprovalSettings::active_key_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_active_key_version("example");
/// ```
pub fn set_active_key_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.active_key_version = v.into();
self
}
/// Sets the value of [ancestor_has_active_key_version][crate::model::AccessApprovalSettings::ancestor_has_active_key_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_ancestor_has_active_key_version(true);
/// ```
pub fn set_ancestor_has_active_key_version<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.ancestor_has_active_key_version = v.into();
self
}
/// Sets the value of [invalid_key_version][crate::model::AccessApprovalSettings::invalid_key_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = AccessApprovalSettings::new().set_invalid_key_version(true);
/// ```
pub fn set_invalid_key_version<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.invalid_key_version = v.into();
self
}
}
impl wkt::message::Message for AccessApprovalSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.AccessApprovalSettings"
}
}
/// Access Approval service account related to a project/folder/organization.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessApprovalServiceAccount {
/// The resource name of the Access Approval service account. Format is one of:
///
/// * "projects/{project}/serviceAccount"
/// * "folders/{folder}/serviceAccount"
/// * "organizations/{organization}/serviceAccount"
pub name: std::string::String,
/// Email address of the service account.
pub account_email: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessApprovalServiceAccount {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::AccessApprovalServiceAccount::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalServiceAccount;
/// let x = AccessApprovalServiceAccount::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [account_email][crate::model::AccessApprovalServiceAccount::account_email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::AccessApprovalServiceAccount;
/// let x = AccessApprovalServiceAccount::new().set_account_email("example");
/// ```
pub fn set_account_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.account_email = v.into();
self
}
}
impl wkt::message::Message for AccessApprovalServiceAccount {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.AccessApprovalServiceAccount"
}
}
/// Request to list approval requests.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListApprovalRequestsMessage {
/// The parent resource. This may be "projects/{project}",
/// "folders/{folder}", or "organizations/{organization}".
pub parent: std::string::String,
/// A filter on the type of approval requests to retrieve. Must be one of the
/// following values:
///
/// * [not set]: Requests that are pending or have active approvals.
/// * ALL: All requests.
/// * PENDING: Only pending requests.
/// * ACTIVE: Only active (i.e. currently approved) requests.
/// * DISMISSED: Only requests that have been dismissed, or requests that
/// are not approved and past expiration.
/// * EXPIRED: Only requests that have been approved, and the approval has
/// expired.
/// * HISTORY: Active, dismissed and expired requests.
pub filter: std::string::String,
/// Requested page size.
pub page_size: i32,
/// A token identifying the page of results to return.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListApprovalRequestsMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListApprovalRequestsMessage::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsMessage;
/// let x = ListApprovalRequestsMessage::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListApprovalRequestsMessage::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsMessage;
/// let x = ListApprovalRequestsMessage::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListApprovalRequestsMessage::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsMessage;
/// let x = ListApprovalRequestsMessage::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListApprovalRequestsMessage::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsMessage;
/// let x = ListApprovalRequestsMessage::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListApprovalRequestsMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ListApprovalRequestsMessage"
}
}
/// Response to listing of ApprovalRequest objects.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListApprovalRequestsResponse {
/// Approval request details.
pub approval_requests: std::vec::Vec<crate::model::ApprovalRequest>,
/// Token to retrieve the next page of results, or empty if there are no more.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListApprovalRequestsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [approval_requests][crate::model::ListApprovalRequestsResponse::approval_requests].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsResponse;
/// use google_cloud_accessapproval_v1::model::ApprovalRequest;
/// let x = ListApprovalRequestsResponse::new()
/// .set_approval_requests([
/// ApprovalRequest::default()/* use setters */,
/// ApprovalRequest::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_approval_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ApprovalRequest>,
{
use std::iter::Iterator;
self.approval_requests = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListApprovalRequestsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ListApprovalRequestsResponse;
/// let x = ListApprovalRequestsResponse::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListApprovalRequestsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ListApprovalRequestsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListApprovalRequestsResponse {
type PageItem = crate::model::ApprovalRequest;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.approval_requests
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request to get an approval request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetApprovalRequestMessage {
/// The name of the approval request to retrieve.
/// Format:
/// "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetApprovalRequestMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetApprovalRequestMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::GetApprovalRequestMessage;
/// let x = GetApprovalRequestMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetApprovalRequestMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.GetApprovalRequestMessage"
}
}
/// Request to approve an ApprovalRequest.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApproveApprovalRequestMessage {
/// Name of the approval request to approve.
pub name: std::string::String,
/// The expiration time of this approval.
pub expire_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ApproveApprovalRequestMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ApproveApprovalRequestMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveApprovalRequestMessage;
/// let x = ApproveApprovalRequestMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [expire_time][crate::model::ApproveApprovalRequestMessage::expire_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveApprovalRequestMessage;
/// use wkt::Timestamp;
/// let x = ApproveApprovalRequestMessage::new().set_expire_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [expire_time][crate::model::ApproveApprovalRequestMessage::expire_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::ApproveApprovalRequestMessage;
/// use wkt::Timestamp;
/// let x = ApproveApprovalRequestMessage::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
/// let x = ApproveApprovalRequestMessage::new().set_or_clear_expire_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ApproveApprovalRequestMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.ApproveApprovalRequestMessage"
}
}
/// Request to dismiss an approval request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DismissApprovalRequestMessage {
/// Name of the ApprovalRequest to dismiss.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DismissApprovalRequestMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DismissApprovalRequestMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::DismissApprovalRequestMessage;
/// let x = DismissApprovalRequestMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DismissApprovalRequestMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.DismissApprovalRequestMessage"
}
}
/// Request to invalidate an existing approval.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InvalidateApprovalRequestMessage {
/// Name of the ApprovalRequest to invalidate.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InvalidateApprovalRequestMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::InvalidateApprovalRequestMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::InvalidateApprovalRequestMessage;
/// let x = InvalidateApprovalRequestMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for InvalidateApprovalRequestMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.InvalidateApprovalRequestMessage"
}
}
/// Request to get access approval settings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAccessApprovalSettingsMessage {
/// The name of the AccessApprovalSettings to retrieve.
/// Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetAccessApprovalSettingsMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetAccessApprovalSettingsMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::GetAccessApprovalSettingsMessage;
/// let x = GetAccessApprovalSettingsMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetAccessApprovalSettingsMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.GetAccessApprovalSettingsMessage"
}
}
/// Request to update access approval settings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAccessApprovalSettingsMessage {
/// The new AccessApprovalSettings.
pub settings: std::option::Option<crate::model::AccessApprovalSettings>,
/// The update mask applies to the settings. Only the top level fields of
/// AccessApprovalSettings (notification_emails & enrolled_services) are
/// supported. For each field, if it is included, the currently stored value
/// will be entirely overwritten with the value of the field passed in this
/// request.
///
/// For the `FieldMask` definition, see
/// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask>
/// If this field is left unset, only the notification_emails field will be
/// updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateAccessApprovalSettingsMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [settings][crate::model::UpdateAccessApprovalSettingsMessage::settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::UpdateAccessApprovalSettingsMessage;
/// use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = UpdateAccessApprovalSettingsMessage::new().set_settings(AccessApprovalSettings::default()/* use setters */);
/// ```
pub fn set_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AccessApprovalSettings>,
{
self.settings = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [settings][crate::model::UpdateAccessApprovalSettingsMessage::settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::UpdateAccessApprovalSettingsMessage;
/// use google_cloud_accessapproval_v1::model::AccessApprovalSettings;
/// let x = UpdateAccessApprovalSettingsMessage::new().set_or_clear_settings(Some(AccessApprovalSettings::default()/* use setters */));
/// let x = UpdateAccessApprovalSettingsMessage::new().set_or_clear_settings(None::<AccessApprovalSettings>);
/// ```
pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AccessApprovalSettings>,
{
self.settings = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateAccessApprovalSettingsMessage::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::UpdateAccessApprovalSettingsMessage;
/// use wkt::FieldMask;
/// let x = UpdateAccessApprovalSettingsMessage::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateAccessApprovalSettingsMessage::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::UpdateAccessApprovalSettingsMessage;
/// use wkt::FieldMask;
/// let x = UpdateAccessApprovalSettingsMessage::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateAccessApprovalSettingsMessage::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateAccessApprovalSettingsMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.UpdateAccessApprovalSettingsMessage"
}
}
/// Request to delete access approval settings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAccessApprovalSettingsMessage {
/// Name of the AccessApprovalSettings to delete.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteAccessApprovalSettingsMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteAccessApprovalSettingsMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::DeleteAccessApprovalSettingsMessage;
/// let x = DeleteAccessApprovalSettingsMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteAccessApprovalSettingsMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.DeleteAccessApprovalSettingsMessage"
}
}
/// Request to get an Access Approval service account.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAccessApprovalServiceAccountMessage {
/// Name of the AccessApprovalServiceAccount to retrieve.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetAccessApprovalServiceAccountMessage {
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetAccessApprovalServiceAccountMessage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_accessapproval_v1::model::GetAccessApprovalServiceAccountMessage;
/// let x = GetAccessApprovalServiceAccountMessage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetAccessApprovalServiceAccountMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.accessapproval.v1.GetAccessApprovalServiceAccountMessage"
}
}
/// Represents the type of enrollment for a given service to Access Approval.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EnrollmentLevel {
/// Default value for proto, shouldn't be used.
Unspecified,
/// Service is enrolled in Access Approval for all requests
BlockAll,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [EnrollmentLevel::value] or
/// [EnrollmentLevel::name].
UnknownValue(enrollment_level::UnknownValue),
}
#[doc(hidden)]
pub mod enrollment_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EnrollmentLevel {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::BlockAll => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ENROLLMENT_LEVEL_UNSPECIFIED"),
Self::BlockAll => std::option::Option::Some("BLOCK_ALL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EnrollmentLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EnrollmentLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EnrollmentLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::BlockAll,
_ => Self::UnknownValue(enrollment_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EnrollmentLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENROLLMENT_LEVEL_UNSPECIFIED" => Self::Unspecified,
"BLOCK_ALL" => Self::BlockAll,
_ => Self::UnknownValue(enrollment_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EnrollmentLevel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::BlockAll => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EnrollmentLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnrollmentLevel>::new(
".google.cloud.accessapproval.v1.EnrollmentLevel",
))
}
}