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
// This file is @generated by prost-build.
/// Message describing Template resource
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Template {
/// Identifier. name of resource
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. \[Output only\] Create time stamp
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. \[Output only\] Update time stamp
#[prost(message, optional, tag = "3")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Optional. Labels as key value pairs
#[prost(map = "string, string", tag = "4")]
pub labels: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Required. filter configuration for this template
#[prost(message, optional, tag = "5")]
pub filter_config: ::core::option::Option<FilterConfig>,
/// Optional. metadata for this template
#[prost(message, optional, tag = "6")]
pub template_metadata: ::core::option::Option<template::TemplateMetadata>,
}
/// Nested message and enum types in `Template`.
pub mod template {
/// Message describing TemplateMetadata
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TemplateMetadata {
/// Optional. If true, partial detector failures should be ignored.
#[prost(bool, tag = "1")]
pub ignore_partial_invocation_failures: bool,
/// Optional. Indicates the custom error code set by the user to be returned
/// to the end user by the service extension if the prompt trips Model Armor
/// filters.
#[prost(int32, tag = "2")]
pub custom_prompt_safety_error_code: i32,
/// Optional. Indicates the custom error message set by the user to be
/// returned to the end user if the prompt trips Model Armor filters.
#[prost(string, tag = "3")]
pub custom_prompt_safety_error_message: ::prost::alloc::string::String,
/// Optional. Indicates the custom error code set by the user to be returned
/// to the end user if the LLM response trips Model Armor filters.
#[prost(int32, tag = "4")]
pub custom_llm_response_safety_error_code: i32,
/// Optional. Indicates the custom error message set by the user to be
/// returned to the end user if the LLM response trips Model Armor filters.
#[prost(string, tag = "5")]
pub custom_llm_response_safety_error_message: ::prost::alloc::string::String,
/// Optional. If true, log template crud operations.
#[prost(bool, tag = "6")]
pub log_template_operations: bool,
/// Optional. If true, log sanitize operations.
#[prost(bool, tag = "7")]
pub log_sanitize_operations: bool,
/// Optional. Enforcement type for Model Armor filters.
#[prost(enumeration = "template_metadata::EnforcementType", tag = "8")]
pub enforcement_type: i32,
/// Optional. Metadata for multi language detection.
#[prost(message, optional, tag = "9")]
pub multi_language_detection: ::core::option::Option<
template_metadata::MultiLanguageDetection,
>,
}
/// Nested message and enum types in `TemplateMetadata`.
pub mod template_metadata {
/// Metadata to enable multi language detection via template.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MultiLanguageDetection {
/// Required. If true, multi language detection will be enabled.
#[prost(bool, tag = "1")]
pub enable_multi_language_detection: bool,
}
/// Enforcement type for Model Armor filters.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum EnforcementType {
/// Default value. Same as INSPECT_AND_BLOCK.
Unspecified = 0,
/// Model Armor filters will run in inspect only mode. No action will be
/// taken on the request.
InspectOnly = 1,
/// Model Armor filters will run in inspect and block mode. Requests
/// that trip Model Armor filters will be blocked.
InspectAndBlock = 2,
}
impl EnforcementType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "ENFORCEMENT_TYPE_UNSPECIFIED",
Self::InspectOnly => "INSPECT_ONLY",
Self::InspectAndBlock => "INSPECT_AND_BLOCK",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENFORCEMENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"INSPECT_ONLY" => Some(Self::InspectOnly),
"INSPECT_AND_BLOCK" => Some(Self::InspectAndBlock),
_ => None,
}
}
}
}
}
/// Message describing FloorSetting resource
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FloorSetting {
/// Identifier. The resource name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. \[Output only\] Create timestamp
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. \[Output only\] Update timestamp
#[prost(message, optional, tag = "3")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Required. ModelArmor filter configuration.
#[prost(message, optional, tag = "4")]
pub filter_config: ::core::option::Option<FilterConfig>,
/// Optional. Floor Settings enforcement status.
#[prost(bool, optional, tag = "5")]
pub enable_floor_setting_enforcement: ::core::option::Option<bool>,
/// Optional. List of integrated services for which the floor setting is
/// applicable.
#[prost(
enumeration = "floor_setting::IntegratedService",
repeated,
packed = "false",
tag = "6"
)]
pub integrated_services: ::prost::alloc::vec::Vec<i32>,
/// Optional. AI Platform floor setting.
#[prost(message, optional, tag = "7")]
pub ai_platform_floor_setting: ::core::option::Option<AiPlatformFloorSetting>,
/// Optional. Metadata for FloorSetting
#[prost(message, optional, tag = "8")]
pub floor_setting_metadata: ::core::option::Option<
floor_setting::FloorSettingMetadata,
>,
/// Optional. Google MCP Server floor setting.
#[prost(message, optional, tag = "9")]
pub google_mcp_server_floor_setting: ::core::option::Option<McpServerFloorSetting>,
}
/// Nested message and enum types in `FloorSetting`.
pub mod floor_setting {
/// message describing FloorSetting Metadata
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FloorSettingMetadata {
/// Optional. Metadata for multi language detection.
#[prost(message, optional, tag = "1")]
pub multi_language_detection: ::core::option::Option<
floor_setting_metadata::MultiLanguageDetection,
>,
}
/// Nested message and enum types in `FloorSettingMetadata`.
pub mod floor_setting_metadata {
/// Metadata to enable multi language detection via floor setting.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MultiLanguageDetection {
/// Required. If true, multi language detection will be enabled.
#[prost(bool, tag = "1")]
pub enable_multi_language_detection: bool,
}
}
/// Integrated service for which the floor setting is applicable.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum IntegratedService {
/// Unspecified integrated service.
Unspecified = 0,
/// AI Platform.
AiPlatform = 1,
/// Google MCP Server (via Shim Service Extension)
GoogleMcpServer = 2,
}
impl IntegratedService {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INTEGRATED_SERVICE_UNSPECIFIED",
Self::AiPlatform => "AI_PLATFORM",
Self::GoogleMcpServer => "GOOGLE_MCP_SERVER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INTEGRATED_SERVICE_UNSPECIFIED" => Some(Self::Unspecified),
"AI_PLATFORM" => Some(Self::AiPlatform),
"GOOGLE_MCP_SERVER" => Some(Self::GoogleMcpServer),
_ => None,
}
}
}
}
/// Message describing MCP Server Floor Setting.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct McpServerFloorSetting {
/// Optional. If true, log Model Armor filter results to Cloud Logging.
#[prost(bool, tag = "3")]
pub enable_cloud_logging: bool,
/// Optional. List of MCP servers for which the MCP floor setting is
/// applicable. Examples: "bigquery.googleapis.com/mcp",
/// "run.googleapis.com/mcp" Empty list denotes that the floor setting is
/// applicable to all MCP servers.
#[prost(string, repeated, tag = "4")]
pub apis: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// enforcement type for Model Armor filters.
#[prost(oneof = "mcp_server_floor_setting::EnforcementType", tags = "1, 2")]
pub enforcement_type: ::core::option::Option<
mcp_server_floor_setting::EnforcementType,
>,
}
/// Nested message and enum types in `McpServerFloorSetting`.
pub mod mcp_server_floor_setting {
/// enforcement type for Model Armor filters.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum EnforcementType {
/// Optional. If true, Model Armor filters will be run in inspect only mode.
/// No action will be taken on the request.
#[prost(bool, tag = "1")]
InspectOnly(bool),
/// Optional. If true, Model Armor filters will be run in inspect and block
/// mode. Requests that trip Model Armor filters will be blocked.
#[prost(bool, tag = "2")]
InspectAndBlock(bool),
}
}
/// message describing AiPlatformFloorSetting
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AiPlatformFloorSetting {
/// Optional. If true, log Model Armor filter results to Cloud Logging.
#[prost(bool, tag = "3")]
pub enable_cloud_logging: bool,
/// enforcement type for Model Armor filters.
#[prost(oneof = "ai_platform_floor_setting::EnforcementType", tags = "1, 2")]
pub enforcement_type: ::core::option::Option<
ai_platform_floor_setting::EnforcementType,
>,
}
/// Nested message and enum types in `AiPlatformFloorSetting`.
pub mod ai_platform_floor_setting {
/// enforcement type for Model Armor filters.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum EnforcementType {
/// Optional. If true, Model Armor filters will be run in inspect only mode.
/// No action will be taken on the request.
#[prost(bool, tag = "1")]
InspectOnly(bool),
/// Optional. If true, Model Armor filters will be run in inspect and block
/// mode. Requests that trip Model Armor filters will be blocked.
#[prost(bool, tag = "2")]
InspectAndBlock(bool),
}
}
/// Message for requesting list of Templates
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListTemplatesRequest {
/// Required. Parent value for ListTemplatesRequest
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Optional. Requested page size. Server may return fewer items than
/// requested. If unspecified, server will pick an appropriate default.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// Optional. A token identifying a page of results the server should return.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
/// Optional. Filtering results
#[prost(string, tag = "4")]
pub filter: ::prost::alloc::string::String,
/// Optional. Hint for how to order the results
#[prost(string, tag = "5")]
pub order_by: ::prost::alloc::string::String,
}
/// Message for response to listing Templates
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTemplatesResponse {
/// The list of Template
#[prost(message, repeated, tag = "1")]
pub templates: ::prost::alloc::vec::Vec<Template>,
/// A token identifying a page of results the server should return.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
/// Locations that could not be reached.
#[prost(string, repeated, tag = "3")]
pub unreachable: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Message for getting a Template
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTemplateRequest {
/// Required. Name of the resource
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Message for creating a Template
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTemplateRequest {
/// Required. Value for parent.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Id of the requesting object
/// If auto-generating Id server-side, remove this field and
/// template_id from the method_signature of Create RPC
#[prost(string, tag = "2")]
pub template_id: ::prost::alloc::string::String,
/// Required. The resource being created
#[prost(message, optional, tag = "3")]
pub template: ::core::option::Option<Template>,
/// Optional. An optional request ID to identify requests. Specify a unique
/// request ID so that if you must retry your request, the server will know to
/// ignore the request if it has already been completed. The server stores the
/// request ID for 60 minutes after the first request.
///
/// For example, consider a situation where you make an initial request and the
/// request times out. If you make the request again with the same request
/// ID, the server can check if original operation with the same request ID
/// was received, and if so, will ignore the second request. This prevents
/// clients from accidentally creating duplicate commitments.
///
/// The request ID must be a valid UUID with the exception that zero UUID is
/// not supported (00000000-0000-0000-0000-000000000000).
#[prost(string, tag = "4")]
pub request_id: ::prost::alloc::string::String,
}
/// Message for updating a Template
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateTemplateRequest {
/// Required. Field mask is used to specify the fields to be overwritten in the
/// Template resource by the update.
/// The fields specified in the update_mask are relative to the resource, not
/// the full request. A field will be overwritten if it is in the mask. If the
/// user does not provide a mask then all fields will be overwritten.
#[prost(message, optional, tag = "1")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
/// Required. The resource being updated
#[prost(message, optional, tag = "2")]
pub template: ::core::option::Option<Template>,
/// Optional. An optional request ID to identify requests. Specify a unique
/// request ID so that if you must retry your request, the server will know to
/// ignore the request if it has already been completed. The server stores the
/// request ID for 60 minutes after the first request.
///
/// For example, consider a situation where you make an initial request and the
/// request times out. If you make the request again with the same request
/// ID, the server can check if original operation with the same request ID
/// was received, and if so, will ignore the second request. This prevents
/// clients from accidentally creating duplicate commitments.
///
/// The request ID must be a valid UUID with the exception that zero UUID is
/// not supported (00000000-0000-0000-0000-000000000000).
#[prost(string, tag = "3")]
pub request_id: ::prost::alloc::string::String,
}
/// Message for deleting a Template
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteTemplateRequest {
/// Required. Name of the resource
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Optional. An optional request ID to identify requests. Specify a unique
/// request ID so that if you must retry your request, the server will know to
/// ignore the request if it has already been completed. The server stores the
/// request ID for 60 minutes after the first request.
///
/// For example, consider a situation where you make an initial request and the
/// request times out. If you make the request again with the same request
/// ID, the server can check if original operation with the same request ID
/// was received, and if so, will ignore the second request. This prevents
/// clients from accidentally creating duplicate commitments.
///
/// The request ID must be a valid UUID with the exception that zero UUID is
/// not supported (00000000-0000-0000-0000-000000000000).
#[prost(string, tag = "2")]
pub request_id: ::prost::alloc::string::String,
}
/// Message for getting a Floor Setting
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetFloorSettingRequest {
/// Required. The name of the floor setting to get, example
/// projects/123/floorsetting.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Message for Updating a Floor Setting
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateFloorSettingRequest {
/// Required. The floor setting being updated.
#[prost(message, optional, tag = "1")]
pub floor_setting: ::core::option::Option<FloorSetting>,
/// Optional. Field mask is used to specify the fields to be overwritten in the
/// FloorSetting resource by the update.
/// The fields specified in the update_mask are relative to the resource, not
/// the full request. A field will be overwritten if it is in the mask. If the
/// user does not provide a mask then all fields will be overwritten.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Filters configuration.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FilterConfig {
/// Optional. Responsible AI settings.
#[prost(message, optional, tag = "1")]
pub rai_settings: ::core::option::Option<RaiFilterSettings>,
/// Optional. Sensitive Data Protection settings.
#[prost(message, optional, tag = "2")]
pub sdp_settings: ::core::option::Option<SdpFilterSettings>,
/// Optional. Prompt injection and Jailbreak filter settings.
#[prost(message, optional, tag = "3")]
pub pi_and_jailbreak_filter_settings: ::core::option::Option<
PiAndJailbreakFilterSettings,
>,
/// Optional. Malicious URI filter settings.
#[prost(message, optional, tag = "4")]
pub malicious_uri_filter_settings: ::core::option::Option<
MaliciousUriFilterSettings,
>,
}
/// Prompt injection and Jailbreak Filter settings.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PiAndJailbreakFilterSettings {
/// Optional. Tells whether Prompt injection and Jailbreak filter is enabled or
/// disabled.
#[prost(
enumeration = "pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement",
tag = "1"
)]
pub filter_enforcement: i32,
/// Optional. Confidence level for this filter.
/// Confidence level is used to determine the threshold for the filter. If
/// detection confidence is equal to or greater than the specified level, a
/// positive match is reported. Confidence level will only be used if the
/// filter is enabled.
#[prost(enumeration = "DetectionConfidenceLevel", tag = "3")]
pub confidence_level: i32,
}
/// Nested message and enum types in `PiAndJailbreakFilterSettings`.
pub mod pi_and_jailbreak_filter_settings {
/// Option to specify the state of Prompt Injection and Jailbreak filter
/// (ENABLED/DISABLED).
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PiAndJailbreakFilterEnforcement {
/// Same as Disabled
Unspecified = 0,
/// Enabled
Enabled = 1,
/// Disabled
Disabled = 2,
}
impl PiAndJailbreakFilterEnforcement {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED",
Self::Enabled => "ENABLED",
Self::Disabled => "DISABLED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED" => {
Some(Self::Unspecified)
}
"ENABLED" => Some(Self::Enabled),
"DISABLED" => Some(Self::Disabled),
_ => None,
}
}
}
}
/// Malicious URI filter settings.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaliciousUriFilterSettings {
/// Optional. Tells whether the Malicious URI filter is enabled or disabled.
#[prost(
enumeration = "malicious_uri_filter_settings::MaliciousUriFilterEnforcement",
tag = "1"
)]
pub filter_enforcement: i32,
}
/// Nested message and enum types in `MaliciousUriFilterSettings`.
pub mod malicious_uri_filter_settings {
/// Option to specify the state of Malicious URI filter (ENABLED/DISABLED).
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum MaliciousUriFilterEnforcement {
/// Same as Disabled
Unspecified = 0,
/// Enabled
Enabled = 1,
/// Disabled
Disabled = 2,
}
impl MaliciousUriFilterEnforcement {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED",
Self::Enabled => "ENABLED",
Self::Disabled => "DISABLED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED" => Some(Self::Unspecified),
"ENABLED" => Some(Self::Enabled),
"DISABLED" => Some(Self::Disabled),
_ => None,
}
}
}
}
/// Responsible AI Filter settings.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaiFilterSettings {
/// Required. List of Responsible AI filters enabled for template.
#[prost(message, repeated, tag = "1")]
pub rai_filters: ::prost::alloc::vec::Vec<rai_filter_settings::RaiFilter>,
}
/// Nested message and enum types in `RaiFilterSettings`.
pub mod rai_filter_settings {
/// Responsible AI filter.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RaiFilter {
/// Required. Type of responsible AI filter.
#[prost(enumeration = "super::RaiFilterType", tag = "1")]
pub filter_type: i32,
/// Optional. Confidence level for this RAI filter.
/// During data sanitization, if data is classified under this filter with a
/// confidence level equal to or greater than the specified level, a positive
/// match is reported. If the confidence level is unspecified (i.e., 0), the
/// system will use a reasonable default level based on the `filter_type`.
#[prost(enumeration = "super::DetectionConfidenceLevel", tag = "2")]
pub confidence_level: i32,
}
}
/// Sensitive Data Protection settings.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SdpFilterSettings {
/// Either of Sensitive Data Protection basic or advanced configuration.
#[prost(oneof = "sdp_filter_settings::SdpConfiguration", tags = "1, 2")]
pub sdp_configuration: ::core::option::Option<sdp_filter_settings::SdpConfiguration>,
}
/// Nested message and enum types in `SdpFilterSettings`.
pub mod sdp_filter_settings {
/// Either of Sensitive Data Protection basic or advanced configuration.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum SdpConfiguration {
/// Optional. Basic Sensitive Data Protection configuration inspects the
/// content for sensitive data using a fixed set of six info-types. Sensitive
/// Data Protection templates cannot be used with basic configuration. Only
/// Sensitive Data Protection inspection operation is supported with basic
/// configuration.
#[prost(message, tag = "1")]
BasicConfig(super::SdpBasicConfig),
/// Optional. Advanced Sensitive Data Protection configuration which enables
/// use of Sensitive Data Protection templates. Supports both Sensitive Data
/// Protection inspection and de-identification operations.
#[prost(message, tag = "2")]
AdvancedConfig(super::SdpAdvancedConfig),
}
}
/// Sensitive Data Protection basic configuration.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SdpBasicConfig {
/// Optional. Tells whether the Sensitive Data Protection basic config is
/// enabled or disabled.
#[prost(enumeration = "sdp_basic_config::SdpBasicConfigEnforcement", tag = "3")]
pub filter_enforcement: i32,
}
/// Nested message and enum types in `SdpBasicConfig`.
pub mod sdp_basic_config {
/// Option to specify the state of Sensitive Data Protection basic config
/// (ENABLED/DISABLED).
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SdpBasicConfigEnforcement {
/// Same as Disabled
Unspecified = 0,
/// Enabled
Enabled = 1,
/// Disabled
Disabled = 2,
}
impl SdpBasicConfigEnforcement {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED",
Self::Enabled => "ENABLED",
Self::Disabled => "DISABLED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED" => Some(Self::Unspecified),
"ENABLED" => Some(Self::Enabled),
"DISABLED" => Some(Self::Disabled),
_ => None,
}
}
}
}
/// Sensitive Data Protection Advanced configuration.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SdpAdvancedConfig {
/// Optional. Sensitive Data Protection inspect template resource name
///
/// If only inspect template is provided (de-identify template not provided),
/// then Sensitive Data Protection InspectContent action is performed during
/// Sanitization. All Sensitive Data Protection findings identified during
/// inspection will be returned as SdpFinding in SdpInsepctionResult.
///
/// e.g.
/// `projects/{project}/locations/{location}/inspectTemplates/{inspect_template}`
#[prost(string, tag = "1")]
pub inspect_template: ::prost::alloc::string::String,
/// Optional. Optional Sensitive Data Protection Deidentify template resource
/// name.
///
/// If provided then DeidentifyContent action is performed during Sanitization
/// using this template and inspect template. The De-identified data will
/// be returned in SdpDeidentifyResult.
/// Note that all info-types present in the deidentify template must be present
/// in inspect template.
///
/// e.g.
/// `projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}`
#[prost(string, tag = "2")]
pub deidentify_template: ::prost::alloc::string::String,
}
/// Sanitize User Prompt request.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SanitizeUserPromptRequest {
/// Required. Represents resource name of template
/// e.g. name=projects/sample-project/locations/us-central1/templates/templ01
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Required. User prompt data to sanitize.
#[prost(message, optional, tag = "2")]
pub user_prompt_data: ::core::option::Option<DataItem>,
/// Optional. Metadata related to Multi Language Detection.
#[prost(message, optional, tag = "6")]
pub multi_language_detection_metadata: ::core::option::Option<
MultiLanguageDetectionMetadata,
>,
/// Optional. Streaming Mode for StreamSanitize\* API.
#[prost(enumeration = "StreamingMode", optional, tag = "7")]
pub streaming_mode: ::core::option::Option<i32>,
}
/// Sanitize Model Response request.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SanitizeModelResponseRequest {
/// Required. Represents resource name of template
/// e.g. name=projects/sample-project/locations/us-central1/templates/templ01
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Required. Model response data to sanitize.
#[prost(message, optional, tag = "2")]
pub model_response_data: ::core::option::Option<DataItem>,
/// Optional. User Prompt associated with Model response.
#[prost(string, tag = "4")]
pub user_prompt: ::prost::alloc::string::String,
/// Optional. Metadata related for multi language detection.
#[prost(message, optional, tag = "7")]
pub multi_language_detection_metadata: ::core::option::Option<
MultiLanguageDetectionMetadata,
>,
/// Optional. Streaming Mode for StreamSanitize\* API.
#[prost(enumeration = "StreamingMode", optional, tag = "8")]
pub streaming_mode: ::core::option::Option<i32>,
}
/// Sanitized User Prompt Response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SanitizeUserPromptResponse {
/// Output only. Sanitization Result.
#[prost(message, optional, tag = "1")]
pub sanitization_result: ::core::option::Option<SanitizationResult>,
}
/// Sanitized Model Response Response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SanitizeModelResponseResponse {
/// Output only. Sanitization Result.
#[prost(message, optional, tag = "1")]
pub sanitization_result: ::core::option::Option<SanitizationResult>,
}
/// Sanitization result after applying all the filters on input content.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SanitizationResult {
/// Output only. Overall filter match state for Sanitization.
/// The state can have below two values.
///
/// 1. NO_MATCH_FOUND: No filters in configuration satisfy matching criteria.
/// In other words, input passed all filters.
///
/// 1. MATCH_FOUND: At least one filter in configuration satisfies matching.
/// In other words, input did not pass one or more filters.
#[prost(enumeration = "FilterMatchState", tag = "1")]
pub filter_match_state: i32,
/// Output only. Results for all filters where the key is the filter name -
/// either of "csam", "malicious_uris", "rai", "pi_and_jailbreak" ,"sdp".
#[prost(map = "string, message", tag = "2")]
pub filter_results: ::std::collections::HashMap<
::prost::alloc::string::String,
FilterResult,
>,
/// Output only. A field indicating the outcome of the invocation, irrespective
/// of match status. It can have the following three values: SUCCESS: All
/// filters were executed successfully. PARTIAL: Some filters were skipped or
/// failed execution. FAILURE: All filters were skipped or failed execution.
#[prost(enumeration = "InvocationResult", tag = "4")]
pub invocation_result: i32,
/// Output only. Metadata related to Sanitization.
#[prost(message, optional, tag = "3")]
pub sanitization_metadata: ::core::option::Option<
sanitization_result::SanitizationMetadata,
>,
}
/// Nested message and enum types in `SanitizationResult`.
pub mod sanitization_result {
/// Message describing Sanitization metadata.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SanitizationMetadata {
/// Error code if any.
#[prost(int64, tag = "1")]
pub error_code: i64,
/// Error message if any.
#[prost(string, tag = "2")]
pub error_message: ::prost::alloc::string::String,
/// Passthrough field defined in TemplateMetadata to indicate whether to
/// ignore partial invocation failures.
#[prost(bool, tag = "3")]
pub ignore_partial_invocation_failures: bool,
}
}
/// Message for Enabling Multi Language Detection.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MultiLanguageDetectionMetadata {
/// Optional. Optional Source language of the user prompt.
///
/// If multi-language detection is enabled and this field is not set, the
/// source language will be automatically detected. When a source language is
/// provided, Model Armor uses it to sanitize the input. In that case the
/// system does not perform auto-detection and relies solely on the specified
/// language.
///
/// This string field accepts a language code from the ISO-639 standard.
/// For a list of languages supported by Model Armor, see
/// \[Model Armor supported languages\]
/// (<https://cloud.google.com/security-command-center/docs/model-armor-overview#languages-supported>).
/// For a comprehensive list of language codes, see
/// [ISO-639](<https://cloud.google.com/translate/docs/languages#nmt>).
#[prost(string, tag = "1")]
pub source_language: ::prost::alloc::string::String,
/// Optional. Enable detection of multi-language prompts and responses.
#[prost(bool, tag = "2")]
pub enable_multi_language_detection: bool,
}
/// Filter Result obtained after Sanitization operations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FilterResult {
/// Encapsulates one of responsible AI, Sensitive Data Protection, Prompt
/// Injection and Jailbreak, Malicious URI, CSAM, Virus Scan related filter
/// results.
#[prost(oneof = "filter_result::FilterResult", tags = "1, 2, 3, 4, 5, 6")]
pub filter_result: ::core::option::Option<filter_result::FilterResult>,
}
/// Nested message and enum types in `FilterResult`.
pub mod filter_result {
/// Encapsulates one of responsible AI, Sensitive Data Protection, Prompt
/// Injection and Jailbreak, Malicious URI, CSAM, Virus Scan related filter
/// results.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum FilterResult {
/// Responsible AI filter results.
#[prost(message, tag = "1")]
RaiFilterResult(super::RaiFilterResult),
/// Sensitive Data Protection results.
#[prost(message, tag = "2")]
SdpFilterResult(super::SdpFilterResult),
/// Prompt injection and Jailbreak filter results.
#[prost(message, tag = "3")]
PiAndJailbreakFilterResult(super::PiAndJailbreakFilterResult),
/// Malicious URI filter results.
#[prost(message, tag = "4")]
MaliciousUriFilterResult(super::MaliciousUriFilterResult),
/// CSAM filter results.
#[prost(message, tag = "5")]
CsamFilterFilterResult(super::CsamFilterResult),
/// Virus scan results.
#[prost(message, tag = "6")]
VirusScanFilterResult(super::VirusScanFilterResult),
}
}
/// Responsible AI Result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaiFilterResult {
/// Output only. Reports whether the RAI filter was successfully executed or
/// not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Overall filter match state for RAI.
/// Value is MATCH_FOUND if at least one RAI filter confidence level is
/// equal to or higher than the confidence level defined in configuration.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// The map of RAI filter results where key is RAI filter type - either of
/// "sexually_explicit", "hate_speech", "harassment", "dangerous", "violence",
/// "sexually_suggestive".
#[prost(map = "string, message", tag = "4")]
pub rai_filter_type_results: ::std::collections::HashMap<
::prost::alloc::string::String,
rai_filter_result::RaiFilterTypeResult,
>,
}
/// Nested message and enum types in `RaiFilterResult`.
pub mod rai_filter_result {
/// Detailed Filter result for each of the responsible AI Filter Types.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RaiFilterTypeResult {
/// Type of responsible AI filter.
#[prost(enumeration = "super::RaiFilterType", tag = "1")]
pub filter_type: i32,
/// Confidence level identified for this RAI filter.
#[prost(enumeration = "super::DetectionConfidenceLevel", tag = "2")]
pub confidence_level: i32,
/// Output only. Match state for this RAI filter.
#[prost(enumeration = "super::FilterMatchState", tag = "3")]
pub match_state: i32,
}
}
/// Sensitive Data Protection filter result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SdpFilterResult {
/// Either of Sensitive Data Protection Inspect result or Deidentify result.
#[prost(oneof = "sdp_filter_result::Result", tags = "1, 2")]
pub result: ::core::option::Option<sdp_filter_result::Result>,
}
/// Nested message and enum types in `SdpFilterResult`.
pub mod sdp_filter_result {
/// Either of Sensitive Data Protection Inspect result or Deidentify result.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
/// Sensitive Data Protection Inspection result if inspection is performed.
#[prost(message, tag = "1")]
InspectResult(super::SdpInspectResult),
/// Sensitive Data Protection Deidentification result if deidentification is
/// performed.
#[prost(message, tag = "2")]
DeidentifyResult(super::SdpDeidentifyResult),
}
}
/// Sensitive Data Protection Inspection Result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SdpInspectResult {
/// Output only. Reports whether Sensitive Data Protection inspection was
/// successfully executed or not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match state for SDP Inspection.
/// Value is MATCH_FOUND if at least one Sensitive Data Protection finding is
/// identified.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// List of Sensitive Data Protection findings.
#[prost(message, repeated, tag = "4")]
pub findings: ::prost::alloc::vec::Vec<SdpFinding>,
/// If true, then there is possibility that more findings were identified and
/// the findings returned are a subset of all findings. The findings
/// list might be truncated because the input items were too large, or because
/// the server reached the maximum amount of resources allowed for a single API
/// call.
#[prost(bool, tag = "5")]
pub findings_truncated: bool,
}
/// Represents Data item
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DataItem {
/// Either of text or bytes data.
#[prost(oneof = "data_item::DataItem", tags = "1, 2")]
pub data_item: ::core::option::Option<data_item::DataItem>,
}
/// Nested message and enum types in `DataItem`.
pub mod data_item {
/// Either of text or bytes data.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum DataItem {
/// Plaintext string data for sanitization.
#[prost(string, tag = "1")]
Text(::prost::alloc::string::String),
/// Data provided in the form of bytes.
#[prost(message, tag = "2")]
ByteItem(super::ByteDataItem),
}
}
/// Represents Byte Data item.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ByteDataItem {
/// Required. The type of byte data
#[prost(enumeration = "byte_data_item::ByteItemType", tag = "1")]
pub byte_data_type: i32,
/// Required. Bytes Data
#[prost(bytes = "vec", tag = "2")]
pub byte_data: ::prost::alloc::vec::Vec<u8>,
/// Optional. Label of the file. This is used to identify the file in the
/// response.
#[prost(string, tag = "3")]
pub file_label: ::prost::alloc::string::String,
}
/// Nested message and enum types in `ByteDataItem`.
pub mod byte_data_item {
/// Option to specify the type of byte data.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ByteItemType {
/// Unused
Unspecified = 0,
/// plain text
PlaintextUtf8 = 1,
/// PDF
Pdf = 2,
/// DOCX, DOCM, DOTX, DOTM
WordDocument = 3,
/// XLSX, XLSM, XLTX, XLYM
ExcelDocument = 4,
/// PPTX, PPTM, POTX, POTM, POT
PowerpointDocument = 5,
/// TXT
Txt = 6,
/// CSV
Csv = 7,
/// ZIP
Zip = 9,
}
impl ByteItemType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "BYTE_ITEM_TYPE_UNSPECIFIED",
Self::PlaintextUtf8 => "PLAINTEXT_UTF8",
Self::Pdf => "PDF",
Self::WordDocument => "WORD_DOCUMENT",
Self::ExcelDocument => "EXCEL_DOCUMENT",
Self::PowerpointDocument => "POWERPOINT_DOCUMENT",
Self::Txt => "TXT",
Self::Csv => "CSV",
Self::Zip => "ZIP",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BYTE_ITEM_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"PLAINTEXT_UTF8" => Some(Self::PlaintextUtf8),
"PDF" => Some(Self::Pdf),
"WORD_DOCUMENT" => Some(Self::WordDocument),
"EXCEL_DOCUMENT" => Some(Self::ExcelDocument),
"POWERPOINT_DOCUMENT" => Some(Self::PowerpointDocument),
"TXT" => Some(Self::Txt),
"CSV" => Some(Self::Csv),
"ZIP" => Some(Self::Zip),
_ => None,
}
}
}
}
/// Sensitive Data Protection Deidentification Result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SdpDeidentifyResult {
/// Output only. Reports whether Sensitive Data Protection deidentification was
/// successfully executed or not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match state for Sensitive Data Protection Deidentification.
/// Value is MATCH_FOUND if content is de-identified.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// De-identified data.
#[prost(message, optional, tag = "4")]
pub data: ::core::option::Option<DataItem>,
/// Total size in bytes that were transformed during deidentification.
#[prost(int64, tag = "5")]
pub transformed_bytes: i64,
/// List of Sensitive Data Protection info-types that were de-identified.
#[prost(string, repeated, tag = "6")]
pub info_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Finding corresponding to Sensitive Data Protection filter.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SdpFinding {
/// Name of Sensitive Data Protection info type for this finding.
#[prost(string, tag = "1")]
pub info_type: ::prost::alloc::string::String,
/// Identified confidence likelihood for `info_type`.
#[prost(enumeration = "SdpFindingLikelihood", tag = "2")]
pub likelihood: i32,
/// Location for this finding.
#[prost(message, optional, tag = "3")]
pub location: ::core::option::Option<sdp_finding::SdpFindingLocation>,
}
/// Nested message and enum types in `SdpFinding`.
pub mod sdp_finding {
/// Location of this Sensitive Data Protection Finding within input content.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SdpFindingLocation {
/// Zero-based byte offsets delimiting the finding.
/// These are relative to the finding's containing element.
/// Note that when the content is not textual, this references
/// the UTF-8 encoded textual representation of the content.
/// Note: Omitted if content is an image.
#[prost(message, optional, tag = "1")]
pub byte_range: ::core::option::Option<super::RangeInfo>,
/// Unicode character offsets delimiting the finding.
/// These are relative to the finding's containing element.
/// Provided when the content is text.
/// Note: Omitted if content is an image.
#[prost(message, optional, tag = "2")]
pub codepoint_range: ::core::option::Option<super::RangeInfo>,
}
}
/// Prompt injection and Jailbreak Filter Result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PiAndJailbreakFilterResult {
/// Output only. Reports whether Prompt injection and Jailbreak filter was
/// successfully executed or not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match state for Prompt injection and Jailbreak.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// Confidence level identified for Prompt injection and Jailbreak.
#[prost(enumeration = "DetectionConfidenceLevel", tag = "5")]
pub confidence_level: i32,
}
/// Malicious URI Filter Result.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MaliciousUriFilterResult {
/// Output only. Reports whether Malicious URI filter was successfully executed
/// or not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match state for this Malicious URI.
/// Value is MATCH_FOUND if at least one Malicious URI is found.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// List of Malicious URIs found in data.
#[prost(message, repeated, tag = "4")]
pub malicious_uri_matched_items: ::prost::alloc::vec::Vec<
malicious_uri_filter_result::MaliciousUriMatchedItem,
>,
}
/// Nested message and enum types in `MaliciousUriFilterResult`.
pub mod malicious_uri_filter_result {
/// Information regarding malicious URI and its location within the input
/// content.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MaliciousUriMatchedItem {
/// Malicious URI.
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
/// List of locations where Malicious URI is identified.
/// The `locations` field is supported only for plaintext content i.e.
/// ByteItemType.PLAINTEXT_UTF8
#[prost(message, repeated, tag = "2")]
pub locations: ::prost::alloc::vec::Vec<super::RangeInfo>,
}
}
/// Virus scan results.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VirusScanFilterResult {
/// Output only. Reports whether Virus Scan was successfully executed or not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution status is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match status for Virus.
/// Value is MATCH_FOUND if the data is infected with a virus.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
/// Type of content scanned.
#[prost(enumeration = "virus_scan_filter_result::ScannedContentType", tag = "4")]
pub scanned_content_type: i32,
/// Size of scanned content in bytes.
#[prost(int64, optional, tag = "5")]
pub scanned_size: ::core::option::Option<i64>,
/// List of Viruses identified.
/// This field will be empty if no virus was detected.
#[prost(message, repeated, tag = "6")]
pub virus_details: ::prost::alloc::vec::Vec<VirusDetail>,
}
/// Nested message and enum types in `VirusScanFilterResult`.
pub mod virus_scan_filter_result {
/// Type of content scanned.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ScannedContentType {
/// Unused
Unspecified = 0,
/// Unknown content
Unknown = 1,
/// Plaintext
Plaintext = 2,
/// PDF
/// Scanning for only PDF is supported.
Pdf = 3,
}
impl ScannedContentType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "SCANNED_CONTENT_TYPE_UNSPECIFIED",
Self::Unknown => "UNKNOWN",
Self::Plaintext => "PLAINTEXT",
Self::Pdf => "PDF",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SCANNED_CONTENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"UNKNOWN" => Some(Self::Unknown),
"PLAINTEXT" => Some(Self::Plaintext),
"PDF" => Some(Self::Pdf),
_ => None,
}
}
}
}
/// Details of an identified virus
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VirusDetail {
/// Name of vendor that produced this virus identification.
#[prost(string, tag = "1")]
pub vendor: ::prost::alloc::string::String,
/// Names of this Virus.
#[prost(string, repeated, tag = "2")]
pub names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Threat type of the identified virus
#[prost(enumeration = "virus_detail::ThreatType", tag = "3")]
pub threat_type: i32,
}
/// Nested message and enum types in `VirusDetail`.
pub mod virus_detail {
/// Defines all the threat types of a virus
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ThreatType {
/// Unused
Unspecified = 0,
/// Unable to categorize threat
Unknown = 1,
/// Virus or Worm threat.
VirusOrWorm = 2,
/// Malicious program. E.g. Spyware, Trojan.
MaliciousProgram = 3,
/// Potentially harmful content. E.g. Injected code, Macro
PotentiallyHarmfulContent = 4,
/// Potentially unwanted content. E.g. Adware.
PotentiallyUnwantedContent = 5,
}
impl ThreatType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "THREAT_TYPE_UNSPECIFIED",
Self::Unknown => "UNKNOWN",
Self::VirusOrWorm => "VIRUS_OR_WORM",
Self::MaliciousProgram => "MALICIOUS_PROGRAM",
Self::PotentiallyHarmfulContent => "POTENTIALLY_HARMFUL_CONTENT",
Self::PotentiallyUnwantedContent => "POTENTIALLY_UNWANTED_CONTENT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"THREAT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"UNKNOWN" => Some(Self::Unknown),
"VIRUS_OR_WORM" => Some(Self::VirusOrWorm),
"MALICIOUS_PROGRAM" => Some(Self::MaliciousProgram),
"POTENTIALLY_HARMFUL_CONTENT" => Some(Self::PotentiallyHarmfulContent),
"POTENTIALLY_UNWANTED_CONTENT" => Some(Self::PotentiallyUnwantedContent),
_ => None,
}
}
}
}
/// CSAM (Child Safety Abuse Material) Filter Result
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CsamFilterResult {
/// Output only. Reports whether the CSAM filter was successfully executed or
/// not.
#[prost(enumeration = "FilterExecutionState", tag = "1")]
pub execution_state: i32,
/// Optional messages corresponding to the result.
/// A message can provide warnings or error details.
/// For example, if execution state is skipped then this field provides
/// related reason/explanation.
#[prost(message, repeated, tag = "2")]
pub message_items: ::prost::alloc::vec::Vec<MessageItem>,
/// Output only. Match state for CSAM.
#[prost(enumeration = "FilterMatchState", tag = "3")]
pub match_state: i32,
}
/// Message item to report information, warning or error messages.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MessageItem {
/// Type of message.
#[prost(enumeration = "message_item::MessageType", tag = "1")]
pub message_type: i32,
/// The message content.
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
/// Nested message and enum types in `MessageItem`.
pub mod message_item {
/// Option to specify the type of message.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum MessageType {
/// Unused
Unspecified = 0,
/// Information related message.
Info = 1,
/// Warning related message.
Warning = 2,
/// Error message.
Error = 3,
}
impl MessageType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "MESSAGE_TYPE_UNSPECIFIED",
Self::Info => "INFO",
Self::Warning => "WARNING",
Self::Error => "ERROR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MESSAGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"INFO" => Some(Self::Info),
"WARNING" => Some(Self::Warning),
"ERROR" => Some(Self::Error),
_ => None,
}
}
}
}
/// Half-open range interval \[start, end)
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RangeInfo {
/// For proto3, value cannot be set to 0 unless the field is optional.
/// Ref: <https://protobuf.dev/programming-guides/proto3/#default>
/// Index of first character (inclusive).
#[prost(int64, optional, tag = "1")]
pub start: ::core::option::Option<i64>,
/// Index of last character (exclusive).
#[prost(int64, optional, tag = "2")]
pub end: ::core::option::Option<i64>,
}
/// Option to specify filter match state.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum FilterMatchState {
/// Unused
Unspecified = 0,
/// Matching criteria is not achieved for filters.
NoMatchFound = 1,
/// Matching criteria is achieved for the filter.
MatchFound = 2,
}
impl FilterMatchState {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "FILTER_MATCH_STATE_UNSPECIFIED",
Self::NoMatchFound => "NO_MATCH_FOUND",
Self::MatchFound => "MATCH_FOUND",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"FILTER_MATCH_STATE_UNSPECIFIED" => Some(Self::Unspecified),
"NO_MATCH_FOUND" => Some(Self::NoMatchFound),
"MATCH_FOUND" => Some(Self::MatchFound),
_ => None,
}
}
}
/// Enum which reports whether a specific filter executed successfully or not.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum FilterExecutionState {
/// Unused
Unspecified = 0,
/// Filter executed successfully
ExecutionSuccess = 1,
/// Filter execution was skipped. This can happen due to server-side error
/// or permission issue.
ExecutionSkipped = 2,
}
impl FilterExecutionState {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "FILTER_EXECUTION_STATE_UNSPECIFIED",
Self::ExecutionSuccess => "EXECUTION_SUCCESS",
Self::ExecutionSkipped => "EXECUTION_SKIPPED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"FILTER_EXECUTION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
"EXECUTION_SUCCESS" => Some(Self::ExecutionSuccess),
"EXECUTION_SKIPPED" => Some(Self::ExecutionSkipped),
_ => None,
}
}
}
/// Options for responsible AI Filter Types.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RaiFilterType {
/// Unspecified filter type.
Unspecified = 0,
/// Sexually Explicit.
SexuallyExplicit = 2,
/// Hate Speech.
HateSpeech = 3,
/// Harassment.
Harassment = 6,
/// Danger
Dangerous = 17,
}
impl RaiFilterType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "RAI_FILTER_TYPE_UNSPECIFIED",
Self::SexuallyExplicit => "SEXUALLY_EXPLICIT",
Self::HateSpeech => "HATE_SPEECH",
Self::Harassment => "HARASSMENT",
Self::Dangerous => "DANGEROUS",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RAI_FILTER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"SEXUALLY_EXPLICIT" => Some(Self::SexuallyExplicit),
"HATE_SPEECH" => Some(Self::HateSpeech),
"HARASSMENT" => Some(Self::Harassment),
"DANGEROUS" => Some(Self::Dangerous),
_ => None,
}
}
}
/// Confidence levels for detectors.
/// Higher value maps to a greater confidence level. To enforce stricter level a
/// lower value should be used.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DetectionConfidenceLevel {
/// Same as LOW_AND_ABOVE.
Unspecified = 0,
/// Highest chance of a false positive.
LowAndAbove = 1,
/// Some chance of false positives.
MediumAndAbove = 2,
/// Low chance of false positives.
High = 3,
}
impl DetectionConfidenceLevel {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED",
Self::LowAndAbove => "LOW_AND_ABOVE",
Self::MediumAndAbove => "MEDIUM_AND_ABOVE",
Self::High => "HIGH",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED" => Some(Self::Unspecified),
"LOW_AND_ABOVE" => Some(Self::LowAndAbove),
"MEDIUM_AND_ABOVE" => Some(Self::MediumAndAbove),
"HIGH" => Some(Self::High),
_ => None,
}
}
}
/// For more information about each Sensitive Data Protection likelihood level,
/// see <https://cloud.google.com/sensitive-data-protection/docs/likelihood.>
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SdpFindingLikelihood {
/// Default value; same as POSSIBLE.
Unspecified = 0,
/// Highest chance of a false positive.
VeryUnlikely = 1,
/// High chance of a false positive.
Unlikely = 2,
/// Some matching signals. The default value.
Possible = 3,
/// Low chance of a false positive.
Likely = 4,
/// Confidence level is high. Lowest chance of a false positive.
VeryLikely = 5,
}
impl SdpFindingLikelihood {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "SDP_FINDING_LIKELIHOOD_UNSPECIFIED",
Self::VeryUnlikely => "VERY_UNLIKELY",
Self::Unlikely => "UNLIKELY",
Self::Possible => "POSSIBLE",
Self::Likely => "LIKELY",
Self::VeryLikely => "VERY_LIKELY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SDP_FINDING_LIKELIHOOD_UNSPECIFIED" => Some(Self::Unspecified),
"VERY_UNLIKELY" => Some(Self::VeryUnlikely),
"UNLIKELY" => Some(Self::Unlikely),
"POSSIBLE" => Some(Self::Possible),
"LIKELY" => Some(Self::Likely),
"VERY_LIKELY" => Some(Self::VeryLikely),
_ => None,
}
}
}
/// A field indicating the outcome of the invocation, irrespective of match
/// status.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InvocationResult {
/// Unused. Default value.
Unspecified = 0,
/// All filters were invoked successfully.
Success = 1,
/// Some filters were skipped or failed.
Partial = 2,
/// All filters were skipped or failed.
Failure = 3,
}
impl InvocationResult {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INVOCATION_RESULT_UNSPECIFIED",
Self::Success => "SUCCESS",
Self::Partial => "PARTIAL",
Self::Failure => "FAILURE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVOCATION_RESULT_UNSPECIFIED" => Some(Self::Unspecified),
"SUCCESS" => Some(Self::Success),
"PARTIAL" => Some(Self::Partial),
"FAILURE" => Some(Self::Failure),
_ => None,
}
}
}
/// Streaming Mode for Sanitize\* API.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StreamingMode {
/// Default value.
Unspecified = 0,
/// Buffered Streaming mode.
Buffered = 1,
/// Real Time Streaming mode.
Realtime = 2,
}
impl StreamingMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "STREAMING_MODE_UNSPECIFIED",
Self::Buffered => "STREAMING_MODE_BUFFERED",
Self::Realtime => "STREAMING_MODE_REALTIME",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STREAMING_MODE_UNSPECIFIED" => Some(Self::Unspecified),
"STREAMING_MODE_BUFFERED" => Some(Self::Buffered),
"STREAMING_MODE_REALTIME" => Some(Self::Realtime),
_ => None,
}
}
}
/// Generated client implementations.
pub mod model_armor_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service describing handlers for resources
#[derive(Debug, Clone)]
pub struct ModelArmorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ModelArmorClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ModelArmorClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ModelArmorClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ModelArmorClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Lists Templates in a given project and location.
pub async fn list_templates(
&mut self,
request: impl tonic::IntoRequest<super::ListTemplatesRequest>,
) -> std::result::Result<
tonic::Response<super::ListTemplatesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/ListTemplates",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"ListTemplates",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets details of a single Template.
pub async fn get_template(
&mut self,
request: impl tonic::IntoRequest<super::GetTemplateRequest>,
) -> std::result::Result<tonic::Response<super::Template>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/GetTemplate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"GetTemplate",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a new Template in a given project and location.
pub async fn create_template(
&mut self,
request: impl tonic::IntoRequest<super::CreateTemplateRequest>,
) -> std::result::Result<tonic::Response<super::Template>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/CreateTemplate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"CreateTemplate",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates the parameters of a single Template.
pub async fn update_template(
&mut self,
request: impl tonic::IntoRequest<super::UpdateTemplateRequest>,
) -> std::result::Result<tonic::Response<super::Template>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/UpdateTemplate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"UpdateTemplate",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes a single Template.
pub async fn delete_template(
&mut self,
request: impl tonic::IntoRequest<super::DeleteTemplateRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/DeleteTemplate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"DeleteTemplate",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets details of a single floor setting of a project
pub async fn get_floor_setting(
&mut self,
request: impl tonic::IntoRequest<super::GetFloorSettingRequest>,
) -> std::result::Result<tonic::Response<super::FloorSetting>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/GetFloorSetting",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"GetFloorSetting",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates the parameters of a single floor setting of a project
pub async fn update_floor_setting(
&mut self,
request: impl tonic::IntoRequest<super::UpdateFloorSettingRequest>,
) -> std::result::Result<tonic::Response<super::FloorSetting>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/UpdateFloorSetting",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"UpdateFloorSetting",
),
);
self.inner.unary(req, path, codec).await
}
/// Sanitizes User Prompt.
pub async fn sanitize_user_prompt(
&mut self,
request: impl tonic::IntoRequest<super::SanitizeUserPromptRequest>,
) -> std::result::Result<
tonic::Response<super::SanitizeUserPromptResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/SanitizeUserPrompt",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"SanitizeUserPrompt",
),
);
self.inner.unary(req, path, codec).await
}
/// Sanitizes Model Response.
pub async fn sanitize_model_response(
&mut self,
request: impl tonic::IntoRequest<super::SanitizeModelResponseRequest>,
) -> std::result::Result<
tonic::Response<super::SanitizeModelResponseResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/SanitizeModelResponse",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"SanitizeModelResponse",
),
);
self.inner.unary(req, path, codec).await
}
/// Streaming version of Sanitize User Prompt.
pub async fn stream_sanitize_user_prompt(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::SanitizeUserPromptRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::SanitizeUserPromptResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/StreamSanitizeUserPrompt",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"StreamSanitizeUserPrompt",
),
);
self.inner.streaming(req, path, codec).await
}
/// Streaming version of Sanitizes Model Response.
pub async fn stream_sanitize_model_response(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::SanitizeModelResponseRequest,
>,
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<super::SanitizeModelResponseResponse>,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.modelarmor.v1beta.ModelArmor/StreamSanitizeModelResponse",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.modelarmor.v1beta.ModelArmor",
"StreamSanitizeModelResponse",
),
);
self.inner.streaming(req, path, codec).await
}
}
}