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 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872
// This file is @generated by prost-build.
/// Encapsulates progress related information for a Cloud Spanner long
/// running operation.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OperationProgress {
/// Percent completion of the operation.
/// Values are between 0 and 100 inclusive.
#[prost(int32, tag = "1")]
pub progress_percent: i32,
/// Time the request was received.
#[prost(message, optional, tag = "2")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
/// If set, the time at which this operation failed or was completed
/// successfully.
#[prost(message, optional, tag = "3")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Encryption configuration for a Cloud Spanner database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EncryptionConfig {
/// The Cloud KMS key to be used for encrypting and decrypting
/// the database. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
#[prost(string, tag = "2")]
pub kms_key_name: ::prost::alloc::string::String,
/// Specifies the KMS configuration for the one or more keys used to encrypt
/// the database. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
///
/// The keys referenced by kms_key_names must fully cover all
/// regions of the database instance configuration. Some examples:
/// * For single region database instance configs, specify a single regional
/// location KMS key.
/// * For multi-regional database instance configs of type GOOGLE_MANAGED,
/// either specify a multi-regional location KMS key or multiple regional
/// location KMS keys that cover all regions in the instance config.
/// * For a database instance config of type USER_MANAGED, please specify only
/// regional location KMS keys to cover each region in the instance config.
/// Multi-regional location KMS keys are not supported for USER_MANAGED
/// instance configs.
#[prost(string, repeated, tag = "3")]
pub kms_key_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Encryption information for a Cloud Spanner database or backup.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EncryptionInfo {
/// Output only. The type of encryption.
#[prost(enumeration = "encryption_info::Type", tag = "3")]
pub encryption_type: i32,
/// Output only. If present, the status of a recent encrypt/decrypt call on
/// underlying data for this database or backup. Regardless of status, data is
/// always encrypted at rest.
#[prost(message, optional, tag = "4")]
pub encryption_status: ::core::option::Option<
super::super::super::super::rpc::Status,
>,
/// Output only. A Cloud KMS key version that is being used to protect the
/// database or backup.
#[prost(string, tag = "2")]
pub kms_key_version: ::prost::alloc::string::String,
}
/// Nested message and enum types in `EncryptionInfo`.
pub mod encryption_info {
/// Possible encryption types.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// Encryption type was not specified, though data at rest remains encrypted.
Unspecified = 0,
/// The data is encrypted at rest with a key that is
/// fully managed by Google. No key version or status will be populated.
/// This is the default state.
GoogleDefaultEncryption = 1,
/// The data is encrypted at rest with a key that is
/// managed by the customer. The active version of the key. `kms_key_version`
/// will be populated, and `encryption_status` may be populated.
CustomerManagedEncryption = 2,
}
impl Type {
/// 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 {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::GoogleDefaultEncryption => "GOOGLE_DEFAULT_ENCRYPTION",
Type::CustomerManagedEncryption => "CUSTOMER_MANAGED_ENCRYPTION",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"GOOGLE_DEFAULT_ENCRYPTION" => Some(Self::GoogleDefaultEncryption),
"CUSTOMER_MANAGED_ENCRYPTION" => Some(Self::CustomerManagedEncryption),
_ => None,
}
}
}
}
/// Indicates the dialect type of a database.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DatabaseDialect {
/// Default value. This value will create a database with the
/// GOOGLE_STANDARD_SQL dialect.
Unspecified = 0,
/// GoogleSQL supported SQL.
GoogleStandardSql = 1,
/// PostgreSQL supported SQL.
Postgresql = 2,
}
impl DatabaseDialect {
/// 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 {
DatabaseDialect::Unspecified => "DATABASE_DIALECT_UNSPECIFIED",
DatabaseDialect::GoogleStandardSql => "GOOGLE_STANDARD_SQL",
DatabaseDialect::Postgresql => "POSTGRESQL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DATABASE_DIALECT_UNSPECIFIED" => Some(Self::Unspecified),
"GOOGLE_STANDARD_SQL" => Some(Self::GoogleStandardSql),
"POSTGRESQL" => Some(Self::Postgresql),
_ => None,
}
}
}
/// A backup of a Cloud Spanner database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Backup {
/// Required for the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// operation. Name of the database from which this backup was created. This
/// needs to be in the same instance as the backup. Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>`.
#[prost(string, tag = "2")]
pub database: ::prost::alloc::string::String,
/// The backup will contain an externally consistent copy of the database at
/// the timestamp specified by `version_time`. If `version_time` is not
/// specified, the system will set `version_time` to the `create_time` of the
/// backup.
#[prost(message, optional, tag = "9")]
pub version_time: ::core::option::Option<::prost_types::Timestamp>,
/// Required for the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// operation. The expiration time of the backup, with microseconds
/// granularity that must be at least 6 hours and at most 366 days
/// from the time the CreateBackup request is processed. Once the `expire_time`
/// has passed, the backup is eligible to be automatically deleted by Cloud
/// Spanner to free the resources used by the backup.
#[prost(message, optional, tag = "3")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only for the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// operation. Required for the
/// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]
/// operation.
///
/// A globally unique identifier for the backup which cannot be
/// changed. Values are of the form
/// `projects/<project>/instances/<instance>/backups/[a-z][a-z0-9_\-]*\[a-z0-9\]`
/// The final segment of the name must be between 2 and 60 characters
/// in length.
///
/// The backup is stored in the location(s) specified in the instance
/// configuration of the instance containing the backup, identified
/// by the prefix of the backup name of the form
/// `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. The time the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// request is received. If the request does not specify `version_time`, the
/// `version_time` of the backup will be equivalent to the `create_time`.
#[prost(message, optional, tag = "4")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. Size of the backup in bytes.
#[prost(int64, tag = "5")]
pub size_bytes: i64,
/// Output only. The number of bytes that will be freed by deleting this
/// backup. This value will be zero if, for example, this backup is part of an
/// incremental backup chain and younger backups in the chain require that we
/// keep its data. For backups not in an incremental backup chain, this is
/// always the size of the backup. This value may change if backups on the same
/// chain get created, deleted or expired.
#[prost(int64, tag = "15")]
pub freeable_size_bytes: i64,
/// Output only. For a backup in an incremental backup chain, this is the
/// storage space needed to keep the data that has changed since the previous
/// backup. For all other backups, this is always the size of the backup. This
/// value may change if backups on the same chain get deleted or expired.
///
/// This field can be used to calculate the total storage space used by a set
/// of backups. For example, the total space used by all backups of a database
/// can be computed by summing up this field.
#[prost(int64, tag = "16")]
pub exclusive_size_bytes: i64,
/// Output only. The current state of the backup.
#[prost(enumeration = "backup::State", tag = "6")]
pub state: i32,
/// Output only. The names of the restored databases that reference the backup.
/// The database names are of
/// the form `projects/<project>/instances/<instance>/databases/<database>`.
/// Referencing databases may exist in different instances. The existence of
/// any referencing database prevents the backup from being deleted. When a
/// restored database from the backup enters the `READY` state, the reference
/// to the backup is removed.
#[prost(string, repeated, tag = "7")]
pub referencing_databases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Output only. The encryption information for the backup.
#[prost(message, optional, tag = "8")]
pub encryption_info: ::core::option::Option<EncryptionInfo>,
/// Output only. The encryption information for the backup, whether it is
/// protected by one or more KMS keys. The information includes all Cloud
/// KMS key versions used to encrypt the backup. The `encryption_status' field
/// inside of each `EncryptionInfo` is not populated. At least one of the key
/// versions must be available for the backup to be restored. If a key version
/// is revoked in the middle of a restore, the restore behavior is undefined.
#[prost(message, repeated, tag = "13")]
pub encryption_information: ::prost::alloc::vec::Vec<EncryptionInfo>,
/// Output only. The database dialect information for the backup.
#[prost(enumeration = "DatabaseDialect", tag = "10")]
pub database_dialect: i32,
/// Output only. The names of the destination backups being created by copying
/// this source backup. The backup names are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
/// Referencing backups may exist in different instances. The existence of
/// any referencing backup prevents the backup from being deleted. When the
/// copy operation is done (either successfully completed or cancelled or the
/// destination backup is deleted), the reference to the backup is removed.
#[prost(string, repeated, tag = "11")]
pub referencing_backups: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Output only. The max allowed expiration time of the backup, with
/// microseconds granularity. A backup's expiration time can be configured in
/// multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or
/// copying an existing backup, the expiration time specified must be
/// less than `Backup.max_expire_time`.
#[prost(message, optional, tag = "12")]
pub max_expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. List of backup schedule URIs that are associated with
/// creating this backup. This is only applicable for scheduled backups, and
/// is empty for on-demand backups.
///
/// To optimize for storage, whenever possible, multiple schedules are
/// collapsed together to create one backup. In such cases, this field captures
/// the list of all backup schedule URIs that are associated with creating
/// this backup. If collapsing is not done, then this field captures the
/// single backup schedule URI associated with creating this backup.
#[prost(string, repeated, tag = "14")]
pub backup_schedules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Output only. Populated only for backups in an incremental backup chain.
/// Backups share the same chain id if and only if they belong to the same
/// incremental backup chain. Use this field to determine which backups are
/// part of the same incremental backup chain. The ordering of backups in the
/// chain can be determined by ordering the backup `version_time`.
#[prost(string, tag = "17")]
pub incremental_backup_chain_id: ::prost::alloc::string::String,
/// Output only. Data deleted at a time older than this is guaranteed not to be
/// retained in order to support this backup. For a backup in an incremental
/// backup chain, this is the version time of the oldest backup that exists or
/// ever existed in the chain. For all other backups, this is the version time
/// of the backup. This field can be used to understand what data is being
/// retained by the backup system.
#[prost(message, optional, tag = "18")]
pub oldest_version_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Nested message and enum types in `Backup`.
pub mod backup {
/// Indicates the current state of the backup.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Not specified.
Unspecified = 0,
/// The pending backup is still being created. Operations on the
/// backup may fail with `FAILED_PRECONDITION` in this state.
Creating = 1,
/// The backup is complete and ready for use.
Ready = 2,
}
impl State {
/// 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 {
State::Unspecified => "STATE_UNSPECIFIED",
State::Creating => "CREATING",
State::Ready => "READY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"CREATING" => Some(Self::Creating),
"READY" => Some(Self::Ready),
_ => None,
}
}
}
}
/// The request for
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateBackupRequest {
/// Required. The name of the instance in which the backup will be
/// created. This must be the same instance that contains the database the
/// backup will be created from. The backup will be stored in the
/// location(s) specified in the instance configuration of this
/// instance. Values are of the form
/// `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The id of the backup to be created. The `backup_id` appended to
/// `parent` forms the full backup name of the form
/// `projects/<project>/instances/<instance>/backups/<backup_id>`.
#[prost(string, tag = "2")]
pub backup_id: ::prost::alloc::string::String,
/// Required. The backup to create.
#[prost(message, optional, tag = "3")]
pub backup: ::core::option::Option<Backup>,
/// Optional. The encryption configuration used to encrypt the backup. If this
/// field is not specified, the backup will use the same encryption
/// configuration as the database by default, namely
/// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
/// = `USE_DATABASE_ENCRYPTION`.
#[prost(message, optional, tag = "4")]
pub encryption_config: ::core::option::Option<CreateBackupEncryptionConfig>,
}
/// Metadata type for the operation returned by
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateBackupMetadata {
/// The name of the backup being created.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The name of the database the backup is created from.
#[prost(string, tag = "2")]
pub database: ::prost::alloc::string::String,
/// The progress of the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// operation.
#[prost(message, optional, tag = "3")]
pub progress: ::core::option::Option<OperationProgress>,
/// The time at which cancellation of this operation was received.
/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
/// starts asynchronous cancellation on a long-running operation. The server
/// makes a best effort to cancel the operation, but success is not guaranteed.
/// Clients can use
/// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
/// other methods to check whether the cancellation succeeded or whether the
/// operation completed despite cancellation. On successful cancellation,
/// the operation is not deleted; instead, it becomes an operation with
/// an [Operation.error][google.longrunning.Operation.error] value with a
/// [google.rpc.Status.code][google.rpc.Status.code] of 1,
/// corresponding to `Code.CANCELLED`.
#[prost(message, optional, tag = "4")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// The request for
/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CopyBackupRequest {
/// Required. The name of the destination instance that will contain the backup
/// copy. Values are of the form: `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The id of the backup copy.
/// The `backup_id` appended to `parent` forms the full backup_uri of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "2")]
pub backup_id: ::prost::alloc::string::String,
/// Required. The source backup to be copied.
/// The source backup needs to be in READY state for it to be copied.
/// Once CopyBackup is in progress, the source backup cannot be deleted or
/// cleaned up on expiration until CopyBackup is finished.
/// Values are of the form:
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "3")]
pub source_backup: ::prost::alloc::string::String,
/// Required. The expiration time of the backup in microsecond granularity.
/// The expiration time must be at least 6 hours and at most 366 days
/// from the `create_time` of the source backup. Once the `expire_time` has
/// passed, the backup is eligible to be automatically deleted by Cloud Spanner
/// to free the resources used by the backup.
#[prost(message, optional, tag = "4")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Optional. The encryption configuration used to encrypt the backup. If this
/// field is not specified, the backup will use the same encryption
/// configuration as the source backup by default, namely
/// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
/// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
#[prost(message, optional, tag = "5")]
pub encryption_config: ::core::option::Option<CopyBackupEncryptionConfig>,
}
/// Metadata type for the operation returned by
/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CopyBackupMetadata {
/// The name of the backup being created through the copy operation.
/// Values are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The name of the source backup that is being copied.
/// Values are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "2")]
pub source_backup: ::prost::alloc::string::String,
/// The progress of the
/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
/// operation.
#[prost(message, optional, tag = "3")]
pub progress: ::core::option::Option<OperationProgress>,
/// The time at which cancellation of CopyBackup operation was received.
/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
/// starts asynchronous cancellation on a long-running operation. The server
/// makes a best effort to cancel the operation, but success is not guaranteed.
/// Clients can use
/// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
/// other methods to check whether the cancellation succeeded or whether the
/// operation completed despite cancellation. On successful cancellation,
/// the operation is not deleted; instead, it becomes an operation with
/// an [Operation.error][google.longrunning.Operation.error] value with a
/// [google.rpc.Status.code][google.rpc.Status.code] of 1,
/// corresponding to `Code.CANCELLED`.
#[prost(message, optional, tag = "4")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// The request for
/// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateBackupRequest {
/// Required. The backup to update. `backup.name`, and the fields to be updated
/// as specified by `update_mask` are required. Other fields are ignored.
/// Update is only supported for the following fields:
/// * `backup.expire_time`.
#[prost(message, optional, tag = "1")]
pub backup: ::core::option::Option<Backup>,
/// Required. A mask specifying which fields (e.g. `expire_time`) in the
/// Backup resource should be updated. This mask is relative to the Backup
/// resource, not to the request message. The field mask must always be
/// specified; this prevents any future fields from being erased accidentally
/// by clients that do not know about them.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// The request for
/// [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBackupRequest {
/// Required. Name of the backup.
/// Values are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteBackupRequest {
/// Required. Name of the backup to delete.
/// Values are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupsRequest {
/// Required. The instance to list backups from. Values are of the
/// form `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// An expression that filters the list of returned backups.
///
/// A filter expression consists of a field name, a comparison operator, and a
/// value for filtering.
/// The value must be a string, a number, or a boolean. The comparison operator
/// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
/// Colon `:` is the contains operator. Filter rules are not case sensitive.
///
/// The following fields in the
/// [Backup][google.spanner.admin.database.v1.Backup] are eligible for
/// filtering:
///
/// * `name`
/// * `database`
/// * `state`
/// * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
/// * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
/// * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
/// * `size_bytes`
/// * `backup_schedules`
///
/// You can combine multiple expressions by enclosing each expression in
/// parentheses. By default, expressions are combined with AND logic, but
/// you can specify AND, OR, and NOT logic explicitly.
///
/// Here are a few examples:
///
/// * `name:Howl` - The backup's name contains the string "howl".
/// * `database:prod`
/// - The database's name contains the string "prod".
/// * `state:CREATING` - The backup is pending creation.
/// * `state:READY` - The backup is fully created and ready for use.
/// * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
/// - The backup name contains the string "howl" and `create_time`
/// of the backup is before 2018-03-28T14:50:00Z.
/// * `expire_time < \"2018-03-28T14:50:00Z\"`
/// - The backup `expire_time` is before 2018-03-28T14:50:00Z.
/// * `size_bytes > 10000000000` - The backup's size is greater than 10GB
/// * `backup_schedules:daily`
/// - The backup is created from a schedule with "daily" in its name.
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
/// Number of backups to be returned in the response. If 0 or
/// less, defaults to the server's maximum allowed page size.
#[prost(int32, tag = "3")]
pub page_size: i32,
/// If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]
/// from a previous
/// [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse]
/// to the same `parent` and with the same `filter`.
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupsResponse {
/// The list of matching backups. Backups returned are ordered by `create_time`
/// in descending order, starting from the most recent `create_time`.
#[prost(message, repeated, tag = "1")]
pub backups: ::prost::alloc::vec::Vec<Backup>,
/// `next_page_token` can be sent in a subsequent
/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]
/// call to fetch more of the matching backups.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// The request for
/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupOperationsRequest {
/// Required. The instance of the backup operations. Values are of
/// the form `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// An expression that filters the list of returned backup operations.
///
/// A filter expression consists of a field name, a
/// comparison operator, and a value for filtering.
/// The value must be a string, a number, or a boolean. The comparison operator
/// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
/// Colon `:` is the contains operator. Filter rules are not case sensitive.
///
/// The following fields in the [operation][google.longrunning.Operation]
/// are eligible for filtering:
///
/// * `name` - The name of the long-running operation
/// * `done` - False if the operation is in progress, else true.
/// * `metadata.@type` - the type of metadata. For example, the type string
/// for
/// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
/// is
/// `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
/// * `metadata.<field_name>` - any field in metadata.value.
/// `metadata.@type` must be specified first if filtering on metadata
/// fields.
/// * `error` - Error associated with the long-running operation.
/// * `response.@type` - the type of response.
/// * `response.<field_name>` - any field in response.value.
///
/// You can combine multiple expressions by enclosing each expression in
/// parentheses. By default, expressions are combined with AND logic, but
/// you can specify AND, OR, and NOT logic explicitly.
///
/// Here are a few examples:
///
/// * `done:true` - The operation is complete.
/// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
/// `metadata.database:prod` - Returns operations where:
/// * The operation's metadata type is
/// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
/// * The source database name of backup contains the string "prod".
/// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
/// `(metadata.name:howl) AND` \
/// `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
/// `(error:*)` - Returns operations where:
/// * The operation's metadata type is
/// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
/// * The backup name contains the string "howl".
/// * The operation started before 2018-03-28T14:50:00Z.
/// * The operation resulted in an error.
/// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
/// `(metadata.source_backup:test) AND` \
/// `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
/// `(error:*)` - Returns operations where:
/// * The operation's metadata type is
/// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
/// * The source backup name contains the string "test".
/// * The operation started before 2022-01-18T14:50:00Z.
/// * The operation resulted in an error.
/// * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
/// `(metadata.database:test_db)) OR` \
/// `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
/// AND` \
/// `(metadata.source_backup:test_bkp)) AND` \
/// `(error:*)` - Returns operations where:
/// * The operation's metadata matches either of criteria:
/// * The operation's metadata type is
/// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
/// AND the source database name of the backup contains the string
/// "test_db"
/// * The operation's metadata type is
/// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]
/// AND the source backup name contains the string "test_bkp"
/// * The operation resulted in an error.
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
/// Number of operations to be returned in the response. If 0 or
/// less, defaults to the server's maximum allowed page size.
#[prost(int32, tag = "3")]
pub page_size: i32,
/// If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]
/// from a previous
/// [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse]
/// to the same `parent` and with the same `filter`.
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupOperationsResponse {
/// The list of matching backup [long-running
/// operations][google.longrunning.Operation]. Each operation's name will be
/// prefixed by the backup's name. The operation's
/// [metadata][google.longrunning.Operation.metadata] field type
/// `metadata.type_url` describes the type of the metadata. Operations returned
/// include those that are pending or have completed/failed/canceled within the
/// last 7 days. Operations returned are ordered by
/// `operation.metadata.value.progress.start_time` in descending order starting
/// from the most recently started operation.
#[prost(message, repeated, tag = "1")]
pub operations: ::prost::alloc::vec::Vec<
super::super::super::super::longrunning::Operation,
>,
/// `next_page_token` can be sent in a subsequent
/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]
/// call to fetch more of the matching metadata.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Information about a backup.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BackupInfo {
/// Name of the backup.
#[prost(string, tag = "1")]
pub backup: ::prost::alloc::string::String,
/// The backup contains an externally consistent copy of `source_database` at
/// the timestamp specified by `version_time`. If the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// request did not specify `version_time`, the `version_time` of the backup is
/// equivalent to the `create_time`.
#[prost(message, optional, tag = "4")]
pub version_time: ::core::option::Option<::prost_types::Timestamp>,
/// The time the
/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
/// request was received.
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Name of the database the backup was created from.
#[prost(string, tag = "3")]
pub source_database: ::prost::alloc::string::String,
}
/// Encryption configuration for the backup to create.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateBackupEncryptionConfig {
/// Required. The encryption type of the backup.
#[prost(enumeration = "create_backup_encryption_config::EncryptionType", tag = "1")]
pub encryption_type: i32,
/// Optional. The Cloud KMS key that will be used to protect the backup.
/// This field should be set only when
/// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
/// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
#[prost(string, tag = "2")]
pub kms_key_name: ::prost::alloc::string::String,
/// Optional. Specifies the KMS configuration for the one or more keys used to
/// protect the backup. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
///
/// The keys referenced by kms_key_names must fully cover all
/// regions of the backup's instance configuration. Some examples:
/// * For single region instance configs, specify a single regional
/// location KMS key.
/// * For multi-regional instance configs of type GOOGLE_MANAGED,
/// either specify a multi-regional location KMS key or multiple regional
/// location KMS keys that cover all regions in the instance config.
/// * For an instance config of type USER_MANAGED, please specify only
/// regional location KMS keys to cover each region in the instance config.
/// Multi-regional location KMS keys are not supported for USER_MANAGED
/// instance configs.
#[prost(string, repeated, tag = "3")]
pub kms_key_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Nested message and enum types in `CreateBackupEncryptionConfig`.
pub mod create_backup_encryption_config {
/// Encryption types for the backup.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum EncryptionType {
/// Unspecified. Do not use.
Unspecified = 0,
/// Use the same encryption configuration as the database. This is the
/// default option when
/// [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig]
/// is empty. For example, if the database is using
/// `Customer_Managed_Encryption`, the backup will be using the same Cloud
/// KMS key as the database.
UseDatabaseEncryption = 1,
/// Use Google default encryption.
GoogleDefaultEncryption = 2,
/// Use customer managed encryption. If specified, `kms_key_name`
/// must contain a valid Cloud KMS key.
CustomerManagedEncryption = 3,
}
impl EncryptionType {
/// 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 {
EncryptionType::Unspecified => "ENCRYPTION_TYPE_UNSPECIFIED",
EncryptionType::UseDatabaseEncryption => "USE_DATABASE_ENCRYPTION",
EncryptionType::GoogleDefaultEncryption => "GOOGLE_DEFAULT_ENCRYPTION",
EncryptionType::CustomerManagedEncryption => {
"CUSTOMER_MANAGED_ENCRYPTION"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENCRYPTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"USE_DATABASE_ENCRYPTION" => Some(Self::UseDatabaseEncryption),
"GOOGLE_DEFAULT_ENCRYPTION" => Some(Self::GoogleDefaultEncryption),
"CUSTOMER_MANAGED_ENCRYPTION" => Some(Self::CustomerManagedEncryption),
_ => None,
}
}
}
}
/// Encryption configuration for the copied backup.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CopyBackupEncryptionConfig {
/// Required. The encryption type of the backup.
#[prost(enumeration = "copy_backup_encryption_config::EncryptionType", tag = "1")]
pub encryption_type: i32,
/// Optional. The Cloud KMS key that will be used to protect the backup.
/// This field should be set only when
/// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
/// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
#[prost(string, tag = "2")]
pub kms_key_name: ::prost::alloc::string::String,
/// Optional. Specifies the KMS configuration for the one or more keys used to
/// protect the backup. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
/// Kms keys specified can be in any order.
///
/// The keys referenced by kms_key_names must fully cover all
/// regions of the backup's instance configuration. Some examples:
/// * For single region instance configs, specify a single regional
/// location KMS key.
/// * For multi-regional instance configs of type GOOGLE_MANAGED,
/// either specify a multi-regional location KMS key or multiple regional
/// location KMS keys that cover all regions in the instance config.
/// * For an instance config of type USER_MANAGED, please specify only
/// regional location KMS keys to cover each region in the instance config.
/// Multi-regional location KMS keys are not supported for USER_MANAGED
/// instance configs.
#[prost(string, repeated, tag = "3")]
pub kms_key_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Nested message and enum types in `CopyBackupEncryptionConfig`.
pub mod copy_backup_encryption_config {
/// Encryption types for the backup.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum EncryptionType {
/// Unspecified. Do not use.
Unspecified = 0,
/// This is the default option for
/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
/// when
/// [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig]
/// is not specified. For example, if the source backup is using
/// `Customer_Managed_Encryption`, the backup will be using the same Cloud
/// KMS key as the source backup.
UseConfigDefaultOrBackupEncryption = 1,
/// Use Google default encryption.
GoogleDefaultEncryption = 2,
/// Use customer managed encryption. If specified, either `kms_key_name` or
/// `kms_key_names` must contain valid Cloud KMS key(s).
CustomerManagedEncryption = 3,
}
impl EncryptionType {
/// 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 {
EncryptionType::Unspecified => "ENCRYPTION_TYPE_UNSPECIFIED",
EncryptionType::UseConfigDefaultOrBackupEncryption => {
"USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION"
}
EncryptionType::GoogleDefaultEncryption => "GOOGLE_DEFAULT_ENCRYPTION",
EncryptionType::CustomerManagedEncryption => {
"CUSTOMER_MANAGED_ENCRYPTION"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENCRYPTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
Some(Self::UseConfigDefaultOrBackupEncryption)
}
"GOOGLE_DEFAULT_ENCRYPTION" => Some(Self::GoogleDefaultEncryption),
"CUSTOMER_MANAGED_ENCRYPTION" => Some(Self::CustomerManagedEncryption),
_ => None,
}
}
}
}
/// The specification for full backups.
/// A full backup stores the entire contents of the database at a given
/// version time.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FullBackupSpec {}
/// The specification for incremental backup chains.
/// An incremental backup stores the delta of changes between a previous
/// backup and the database contents at a given version time. An
/// incremental backup chain consists of a full backup and zero or more
/// successive incremental backups. The first backup created for an
/// incremental backup chain is always a full backup.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct IncrementalBackupSpec {}
/// Defines specifications of the backup schedule.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BackupScheduleSpec {
/// Required.
#[prost(oneof = "backup_schedule_spec::ScheduleSpec", tags = "1")]
pub schedule_spec: ::core::option::Option<backup_schedule_spec::ScheduleSpec>,
}
/// Nested message and enum types in `BackupScheduleSpec`.
pub mod backup_schedule_spec {
/// Required.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ScheduleSpec {
/// Cron style schedule specification.
#[prost(message, tag = "1")]
CronSpec(super::CrontabSpec),
}
}
/// BackupSchedule expresses the automated backup creation specification for a
/// Spanner database.
/// Next ID: 10
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BackupSchedule {
/// Identifier. Output only for the
/// [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation.
/// Required for the
/// [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]
/// operation. A globally unique identifier for the backup schedule which
/// cannot be changed. Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/[a-z][a-z0-9_\-]*\[a-z0-9\]`
/// The final segment of the name must be between 2 and 60 characters in
/// length.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Optional. The schedule specification based on which the backup creations
/// are triggered.
#[prost(message, optional, tag = "6")]
pub spec: ::core::option::Option<BackupScheduleSpec>,
/// Optional. The retention duration of a backup that must be at least 6 hours
/// and at most 366 days. The backup is eligible to be automatically deleted
/// once the retention period has elapsed.
#[prost(message, optional, tag = "3")]
pub retention_duration: ::core::option::Option<::prost_types::Duration>,
/// Optional. The encryption configuration that will be used to encrypt the
/// backup. If this field is not specified, the backup will use the same
/// encryption configuration as the database.
#[prost(message, optional, tag = "4")]
pub encryption_config: ::core::option::Option<CreateBackupEncryptionConfig>,
/// Output only. The timestamp at which the schedule was last updated.
/// If the schedule has never been updated, this field contains the timestamp
/// when the schedule was first created.
#[prost(message, optional, tag = "9")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Required. Backup type spec determines the type of backup that is created by
/// the backup schedule. Currently, only full backups are supported.
#[prost(oneof = "backup_schedule::BackupTypeSpec", tags = "7, 8")]
pub backup_type_spec: ::core::option::Option<backup_schedule::BackupTypeSpec>,
}
/// Nested message and enum types in `BackupSchedule`.
pub mod backup_schedule {
/// Required. Backup type spec determines the type of backup that is created by
/// the backup schedule. Currently, only full backups are supported.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum BackupTypeSpec {
/// The schedule creates only full backups.
#[prost(message, tag = "7")]
FullBackupSpec(super::FullBackupSpec),
/// The schedule creates incremental backup chains.
#[prost(message, tag = "8")]
IncrementalBackupSpec(super::IncrementalBackupSpec),
}
}
/// CrontabSpec can be used to specify the version time and frequency at
/// which the backup should be created.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CrontabSpec {
/// Required. Textual representation of the crontab. User can customize the
/// backup frequency and the backup version time using the cron
/// expression. The version time must be in UTC timzeone.
///
/// The backup will contain an externally consistent copy of the
/// database at the version time. Allowed frequencies are 12 hour, 1 day,
/// 1 week and 1 month. Examples of valid cron specifications:
/// * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC.
/// * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC.
/// * `0 2 * * * ` : once a day at 2 past midnight in UTC.
/// * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC.
/// * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC.
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
/// Output only. The time zone of the times in `CrontabSpec.text`. Currently
/// only UTC is supported.
#[prost(string, tag = "2")]
pub time_zone: ::prost::alloc::string::String,
/// Output only. Schedule backups will contain an externally consistent copy
/// of the database at the version time specified in
/// `schedule_spec.cron_spec`. However, Spanner may not initiate the creation
/// of the scheduled backups at that version time. Spanner will initiate
/// the creation of scheduled backups within the time window bounded by the
/// version_time specified in `schedule_spec.cron_spec` and version_time +
/// `creation_window`.
#[prost(message, optional, tag = "3")]
pub creation_window: ::core::option::Option<::prost_types::Duration>,
}
/// The request for
/// [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateBackupScheduleRequest {
/// Required. The name of the database that this backup schedule applies to.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The Id to use for the backup schedule. The `backup_schedule_id`
/// appended to `parent` forms the full backup schedule name of the form
/// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
#[prost(string, tag = "2")]
pub backup_schedule_id: ::prost::alloc::string::String,
/// Required. The backup schedule to create.
#[prost(message, optional, tag = "3")]
pub backup_schedule: ::core::option::Option<BackupSchedule>,
}
/// The request for
/// [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBackupScheduleRequest {
/// Required. The name of the schedule to retrieve.
/// Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteBackupScheduleRequest {
/// Required. The name of the schedule to delete.
/// Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupSchedulesRequest {
/// Required. Database is the parent resource whose backup schedules should be
/// listed. Values are of the form
/// projects/<project>/instances/<instance>/databases/<database>
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Optional. Number of backup schedules to be returned in the response. If 0
/// or less, defaults to the server's maximum allowed page size.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// Optional. If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token]
/// from a previous
/// [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse]
/// to the same `parent`.
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBackupSchedulesResponse {
/// The list of backup schedules for a database.
#[prost(message, repeated, tag = "1")]
pub backup_schedules: ::prost::alloc::vec::Vec<BackupSchedule>,
/// `next_page_token` can be sent in a subsequent
/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]
/// call to fetch more of the schedules.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// The request for
/// [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateBackupScheduleRequest {
/// Required. The backup schedule to update. `backup_schedule.name`, and the
/// fields to be updated as specified by `update_mask` are required. Other
/// fields are ignored.
#[prost(message, optional, tag = "1")]
pub backup_schedule: ::core::option::Option<BackupSchedule>,
/// Required. A mask specifying which fields in the BackupSchedule resource
/// should be updated. This mask is relative to the BackupSchedule resource,
/// not to the request message. The field mask must always be
/// specified; this prevents any future fields from being erased
/// accidentally.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Information about the database restore.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RestoreInfo {
/// The type of the restore source.
#[prost(enumeration = "RestoreSourceType", tag = "1")]
pub source_type: i32,
/// Information about the source used to restore the database.
#[prost(oneof = "restore_info::SourceInfo", tags = "2")]
pub source_info: ::core::option::Option<restore_info::SourceInfo>,
}
/// Nested message and enum types in `RestoreInfo`.
pub mod restore_info {
/// Information about the source used to restore the database.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SourceInfo {
/// Information about the backup used to restore the database. The backup
/// may no longer exist.
#[prost(message, tag = "2")]
BackupInfo(super::BackupInfo),
}
}
/// A Cloud Spanner database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Database {
/// Required. The name of the database. Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>`,
/// where `<database>` is as specified in the `CREATE DATABASE`
/// statement. This name can be passed to other API methods to
/// identify the database.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. The current database state.
#[prost(enumeration = "database::State", tag = "2")]
pub state: i32,
/// Output only. If exists, the time at which the database creation started.
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. Applicable only for restored databases. Contains information
/// about the restore source.
#[prost(message, optional, tag = "4")]
pub restore_info: ::core::option::Option<RestoreInfo>,
/// Output only. For databases that are using customer managed encryption, this
/// field contains the encryption configuration for the database.
/// For databases that are using Google default or other types of encryption,
/// this field is empty.
#[prost(message, optional, tag = "5")]
pub encryption_config: ::core::option::Option<EncryptionConfig>,
/// Output only. For databases that are using customer managed encryption, this
/// field contains the encryption information for the database, such as
/// all Cloud KMS key versions that are in use. The `encryption_status' field
/// inside of each `EncryptionInfo` is not populated.
///
/// For databases that are using Google default or other types of encryption,
/// this field is empty.
///
/// This field is propagated lazily from the backend. There might be a delay
/// from when a key version is being used and when it appears in this field.
#[prost(message, repeated, tag = "8")]
pub encryption_info: ::prost::alloc::vec::Vec<EncryptionInfo>,
/// Output only. The period in which Cloud Spanner retains all versions of data
/// for the database. This is the same as the value of version_retention_period
/// database option set using
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
/// Defaults to 1 hour, if not set.
#[prost(string, tag = "6")]
pub version_retention_period: ::prost::alloc::string::String,
/// Output only. Earliest timestamp at which older versions of the data can be
/// read. This value is continuously updated by Cloud Spanner and becomes stale
/// the moment it is queried. If you are using this value to recover data, make
/// sure to account for the time from the moment when the value is queried to
/// the moment when you initiate the recovery.
#[prost(message, optional, tag = "7")]
pub earliest_version_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The read-write region which contains the database's leader
/// replicas.
///
/// This is the same as the value of default_leader
/// database option set using DatabaseAdmin.CreateDatabase or
/// DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
#[prost(string, tag = "9")]
pub default_leader: ::prost::alloc::string::String,
/// Output only. The dialect of the Cloud Spanner Database.
#[prost(enumeration = "DatabaseDialect", tag = "10")]
pub database_dialect: i32,
/// Whether drop protection is enabled for this database. Defaults to false,
/// if not set. For more details, please see how to [prevent accidental
/// database
/// deletion](<https://cloud.google.com/spanner/docs/prevent-database-deletion>).
#[prost(bool, tag = "11")]
pub enable_drop_protection: bool,
/// Output only. If true, the database is being updated. If false, there are no
/// ongoing update operations for the database.
#[prost(bool, tag = "12")]
pub reconciling: bool,
}
/// Nested message and enum types in `Database`.
pub mod database {
/// Indicates the current state of the database.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Not specified.
Unspecified = 0,
/// The database is still being created. Operations on the database may fail
/// with `FAILED_PRECONDITION` in this state.
Creating = 1,
/// The database is fully created and ready for use.
Ready = 2,
/// The database is fully created and ready for use, but is still
/// being optimized for performance and cannot handle full load.
///
/// In this state, the database still references the backup
/// it was restore from, preventing the backup
/// from being deleted. When optimizations are complete, the full performance
/// of the database will be restored, and the database will transition to
/// `READY` state.
ReadyOptimizing = 3,
}
impl State {
/// 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 {
State::Unspecified => "STATE_UNSPECIFIED",
State::Creating => "CREATING",
State::Ready => "READY",
State::ReadyOptimizing => "READY_OPTIMIZING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"CREATING" => Some(Self::Creating),
"READY" => Some(Self::Ready),
"READY_OPTIMIZING" => Some(Self::ReadyOptimizing),
_ => None,
}
}
}
}
/// The request for
/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabasesRequest {
/// Required. The instance whose databases should be listed.
/// Values are of the form `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Number of databases to be returned in the response. If 0 or less,
/// defaults to the server's maximum allowed page size.
#[prost(int32, tag = "3")]
pub page_size: i32,
/// If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]
/// from a previous
/// [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabasesResponse {
/// Databases that matched the request.
#[prost(message, repeated, tag = "1")]
pub databases: ::prost::alloc::vec::Vec<Database>,
/// `next_page_token` can be sent in a subsequent
/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]
/// call to fetch more of the matching databases.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// The request for
/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseRequest {
/// Required. The name of the instance that will serve the new database.
/// Values are of the form `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. A `CREATE DATABASE` statement, which specifies the ID of the
/// new database. The database ID must conform to the regular expression
/// `[a-z][a-z0-9_\-]*\[a-z0-9\]` and be between 2 and 30 characters in length.
/// If the database ID is a reserved word or if it contains a hyphen, the
/// database ID must be enclosed in backticks (`` ` ``).
#[prost(string, tag = "2")]
pub create_statement: ::prost::alloc::string::String,
/// Optional. A list of DDL statements to run inside the newly created
/// database. Statements can create tables, indexes, etc. These
/// statements execute atomically with the creation of the database:
/// if there is an error in any statement, the database is not created.
#[prost(string, repeated, tag = "3")]
pub extra_statements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. The encryption configuration for the database. If this field is
/// not specified, Cloud Spanner will encrypt/decrypt all data at rest using
/// Google default encryption.
#[prost(message, optional, tag = "4")]
pub encryption_config: ::core::option::Option<EncryptionConfig>,
/// Optional. The dialect of the Cloud Spanner Database.
#[prost(enumeration = "DatabaseDialect", tag = "5")]
pub database_dialect: i32,
/// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
/// 'extra_statements' above.
/// Contains a protobuf-serialized
/// [google.protobuf.FileDescriptorSet](<https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto>).
/// To generate it, [install](<https://grpc.io/docs/protoc-installation/>) and
/// run `protoc` with --include_imports and --descriptor_set_out. For example,
/// to generate for moon/shot/app.proto, run
/// ```
/// $protoc --proto_path=/app_path --proto_path=/lib_path \
/// --include_imports \
/// --descriptor_set_out=descriptors.data \
/// moon/shot/app.proto
/// ```
/// For more details, see protobuffer [self
/// description](<https://developers.google.com/protocol-buffers/docs/techniques#self-description>).
#[prost(bytes = "bytes", tag = "6")]
pub proto_descriptors: ::prost::bytes::Bytes,
}
/// Metadata type for the operation returned by
/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseMetadata {
/// The database being created.
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
}
/// The request for
/// [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseRequest {
/// Required. The name of the requested database. Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateDatabaseRequest {
/// Required. The database to update.
/// The `name` field of the database is of the form
/// `projects/<project>/instances/<instance>/databases/<database>`.
#[prost(message, optional, tag = "1")]
pub database: ::core::option::Option<Database>,
/// Required. The list of fields to update. Currently, only
/// `enable_drop_protection` field can be updated.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Metadata type for the operation returned by
/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateDatabaseMetadata {
/// The request for
/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
#[prost(message, optional, tag = "1")]
pub request: ::core::option::Option<UpdateDatabaseRequest>,
/// The progress of the
/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]
/// operation.
#[prost(message, optional, tag = "2")]
pub progress: ::core::option::Option<OperationProgress>,
/// The time at which this operation was cancelled. If set, this operation is
/// in the process of undoing itself (which is best-effort).
#[prost(message, optional, tag = "3")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Enqueues the given DDL statements to be applied, in order but not
/// necessarily all at once, to the database schema at some point (or
/// points) in the future. The server checks that the statements
/// are executable (syntactically valid, name tables that exist, etc.)
/// before enqueueing them, but they may still fail upon
/// later execution (e.g., if a statement from another batch of
/// statements is applied first and it conflicts in some way, or if
/// there is some data-related problem like a `NULL` value in a column to
/// which `NOT NULL` would be added). If a statement fails, all
/// subsequent statements in the batch are automatically cancelled.
///
/// Each batch of statements is assigned a name which can be used with
/// the [Operations][google.longrunning.Operations] API to monitor
/// progress. See the
/// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]
/// field for more details.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateDatabaseDdlRequest {
/// Required. The database to update.
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
/// Required. DDL statements to be applied to the database.
#[prost(string, repeated, tag = "2")]
pub statements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// If empty, the new update request is assigned an
/// automatically-generated operation ID. Otherwise, `operation_id`
/// is used to construct the name of the resulting
/// [Operation][google.longrunning.Operation].
///
/// Specifying an explicit operation ID simplifies determining
/// whether the statements were executed in the event that the
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
/// call is replayed, or the return value is otherwise lost: the
/// [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]
/// and `operation_id` fields can be combined to form the
/// [name][google.longrunning.Operation.name] of the resulting
/// [longrunning.Operation][google.longrunning.Operation]:
/// `<database>/operations/<operation_id>`.
///
/// `operation_id` should be unique within the database, and must be
/// a valid identifier: `[a-z][a-z0-9_]*`. Note that
/// automatically-generated operation IDs always begin with an
/// underscore. If the named operation already exists,
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
/// returns `ALREADY_EXISTS`.
#[prost(string, tag = "3")]
pub operation_id: ::prost::alloc::string::String,
/// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
/// Contains a protobuf-serialized
/// [google.protobuf.FileDescriptorSet](<https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto>).
/// To generate it, [install](<https://grpc.io/docs/protoc-installation/>) and
/// run `protoc` with --include_imports and --descriptor_set_out. For example,
/// to generate for moon/shot/app.proto, run
/// ```
/// $protoc --proto_path=/app_path --proto_path=/lib_path \
/// --include_imports \
/// --descriptor_set_out=descriptors.data \
/// moon/shot/app.proto
/// ```
/// For more details, see protobuffer [self
/// description](<https://developers.google.com/protocol-buffers/docs/techniques#self-description>).
#[prost(bytes = "bytes", tag = "4")]
pub proto_descriptors: ::prost::bytes::Bytes,
}
/// Action information extracted from a DDL statement. This proto is used to
/// display the brief info of the DDL statement for the operation
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DdlStatementActionInfo {
/// The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc.
/// This field is a non-empty string.
#[prost(string, tag = "1")]
pub action: ::prost::alloc::string::String,
/// The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc.
/// This field can be empty string for some DDL statement,
/// e.g. for statement "ANALYZE", `entity_type` = "".
#[prost(string, tag = "2")]
pub entity_type: ::prost::alloc::string::String,
/// The entity name(s) being operated on the DDL statement.
/// E.g.
/// 1. For statement "CREATE TABLE t1(...)", `entity_names` = \["t1"\].
/// 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = \["r1", "r2"\].
/// 3. For statement "ANALYZE", `entity_names` = \[\].
#[prost(string, repeated, tag = "3")]
pub entity_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Metadata type for the operation returned by
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateDatabaseDdlMetadata {
/// The database being modified.
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
/// For an update this list contains all the statements. For an
/// individual statement, this list contains only that statement.
#[prost(string, repeated, tag = "2")]
pub statements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Reports the commit timestamps of all statements that have
/// succeeded so far, where `commit_timestamps\[i\]` is the commit
/// timestamp for the statement `statements\[i\]`.
#[prost(message, repeated, tag = "3")]
pub commit_timestamps: ::prost::alloc::vec::Vec<::prost_types::Timestamp>,
/// Output only. When true, indicates that the operation is throttled e.g.
/// due to resource constraints. When resources become available the operation
/// will resume and this field will be false again.
#[prost(bool, tag = "4")]
pub throttled: bool,
/// The progress of the
/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
/// operations. All DDL statements will have continuously updating progress,
/// and `progress\[i\]` is the operation progress for `statements\[i\]`. Also,
/// `progress\[i\]` will have start time and end time populated with commit
/// timestamp of operation, as well as a progress of 100% once the operation
/// has completed.
#[prost(message, repeated, tag = "5")]
pub progress: ::prost::alloc::vec::Vec<OperationProgress>,
/// The brief action info for the DDL statements.
/// `actions\[i\]` is the brief info for `statements\[i\]`.
#[prost(message, repeated, tag = "6")]
pub actions: ::prost::alloc::vec::Vec<DdlStatementActionInfo>,
}
/// The request for
/// [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DropDatabaseRequest {
/// Required. The database to be dropped.
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
}
/// The request for
/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseDdlRequest {
/// Required. The database whose schema we wish to get.
/// Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>`
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
}
/// The response for
/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseDdlResponse {
/// A list of formatted DDL statements defining the schema of the database
/// specified in the request.
#[prost(string, repeated, tag = "1")]
pub statements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Proto descriptors stored in the database.
/// Contains a protobuf-serialized
/// [google.protobuf.FileDescriptorSet](<https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto>).
/// For more details, see protobuffer [self
/// description](<https://developers.google.com/protocol-buffers/docs/techniques#self-description>).
#[prost(bytes = "bytes", tag = "2")]
pub proto_descriptors: ::prost::bytes::Bytes,
}
/// The request for
/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabaseOperationsRequest {
/// Required. The instance of the database operations.
/// Values are of the form `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// An expression that filters the list of returned operations.
///
/// A filter expression consists of a field name, a
/// comparison operator, and a value for filtering.
/// The value must be a string, a number, or a boolean. The comparison operator
/// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
/// Colon `:` is the contains operator. Filter rules are not case sensitive.
///
/// The following fields in the [Operation][google.longrunning.Operation]
/// are eligible for filtering:
///
/// * `name` - The name of the long-running operation
/// * `done` - False if the operation is in progress, else true.
/// * `metadata.@type` - the type of metadata. For example, the type string
/// for
/// [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
/// is
/// `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
/// * `metadata.<field_name>` - any field in metadata.value.
/// `metadata.@type` must be specified first, if filtering on metadata
/// fields.
/// * `error` - Error associated with the long-running operation.
/// * `response.@type` - the type of response.
/// * `response.<field_name>` - any field in response.value.
///
/// You can combine multiple expressions by enclosing each expression in
/// parentheses. By default, expressions are combined with AND logic. However,
/// you can specify AND, OR, and NOT logic explicitly.
///
/// Here are a few examples:
///
/// * `done:true` - The operation is complete.
/// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
/// `(metadata.source_type:BACKUP) AND` \
/// `(metadata.backup_info.backup:backup_howl) AND` \
/// `(metadata.name:restored_howl) AND` \
/// `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
/// `(error:*)` - Return operations where:
/// * The operation's metadata type is
/// [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
/// * The database is restored from a backup.
/// * The backup name contains "backup_howl".
/// * The restored database's name contains "restored_howl".
/// * The operation started before 2018-03-28T14:50:00Z.
/// * The operation resulted in an error.
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
/// Number of operations to be returned in the response. If 0 or
/// less, defaults to the server's maximum allowed page size.
#[prost(int32, tag = "3")]
pub page_size: i32,
/// If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
/// from a previous
/// [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse]
/// to the same `parent` and with the same `filter`.
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabaseOperationsResponse {
/// The list of matching database [long-running
/// operations][google.longrunning.Operation]. Each operation's name will be
/// prefixed by the database's name. The operation's
/// [metadata][google.longrunning.Operation.metadata] field type
/// `metadata.type_url` describes the type of the metadata.
#[prost(message, repeated, tag = "1")]
pub operations: ::prost::alloc::vec::Vec<
super::super::super::super::longrunning::Operation,
>,
/// `next_page_token` can be sent in a subsequent
/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]
/// call to fetch more of the matching metadata.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// The request for
/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RestoreDatabaseRequest {
/// Required. The name of the instance in which to create the
/// restored database. This instance must be in the same project and
/// have the same instance configuration as the instance containing
/// the source backup. Values are of the form
/// `projects/<project>/instances/<instance>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The id of the database to create and restore to. This
/// database must not already exist. The `database_id` appended to
/// `parent` forms the full database name of the form
/// `projects/<project>/instances/<instance>/databases/<database_id>`.
#[prost(string, tag = "2")]
pub database_id: ::prost::alloc::string::String,
/// Optional. An encryption configuration describing the encryption type and
/// key resources in Cloud KMS used to encrypt/decrypt the database to restore
/// to. If this field is not specified, the restored database will use the same
/// encryption configuration as the backup by default, namely
/// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
/// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
#[prost(message, optional, tag = "4")]
pub encryption_config: ::core::option::Option<RestoreDatabaseEncryptionConfig>,
/// Required. The source from which to restore.
#[prost(oneof = "restore_database_request::Source", tags = "3")]
pub source: ::core::option::Option<restore_database_request::Source>,
}
/// Nested message and enum types in `RestoreDatabaseRequest`.
pub mod restore_database_request {
/// Required. The source from which to restore.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// Name of the backup from which to restore. Values are of the form
/// `projects/<project>/instances/<instance>/backups/<backup>`.
#[prost(string, tag = "3")]
Backup(::prost::alloc::string::String),
}
}
/// Encryption configuration for the restored database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RestoreDatabaseEncryptionConfig {
/// Required. The encryption type of the restored database.
#[prost(
enumeration = "restore_database_encryption_config::EncryptionType",
tag = "1"
)]
pub encryption_type: i32,
/// Optional. The Cloud KMS key that will be used to encrypt/decrypt the
/// restored database. This field should be set only when
/// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
/// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
#[prost(string, tag = "2")]
pub kms_key_name: ::prost::alloc::string::String,
/// Optional. Specifies the KMS configuration for the one or more keys used to
/// encrypt the database. Values are of the form
/// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
///
/// The keys referenced by kms_key_names must fully cover all
/// regions of the database instance configuration. Some examples:
/// * For single region database instance configs, specify a single regional
/// location KMS key.
/// * For multi-regional database instance configs of type GOOGLE_MANAGED,
/// either specify a multi-regional location KMS key or multiple regional
/// location KMS keys that cover all regions in the instance config.
/// * For a database instance config of type USER_MANAGED, please specify only
/// regional location KMS keys to cover each region in the instance config.
/// Multi-regional location KMS keys are not supported for USER_MANAGED
/// instance configs.
#[prost(string, repeated, tag = "3")]
pub kms_key_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Nested message and enum types in `RestoreDatabaseEncryptionConfig`.
pub mod restore_database_encryption_config {
/// Encryption types for the database to be restored.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum EncryptionType {
/// Unspecified. Do not use.
Unspecified = 0,
/// This is the default option when
/// [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]
/// is not specified.
UseConfigDefaultOrBackupEncryption = 1,
/// Use Google default encryption.
GoogleDefaultEncryption = 2,
/// Use customer managed encryption. If specified, `kms_key_name` must
/// must contain a valid Cloud KMS key.
CustomerManagedEncryption = 3,
}
impl EncryptionType {
/// 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 {
EncryptionType::Unspecified => "ENCRYPTION_TYPE_UNSPECIFIED",
EncryptionType::UseConfigDefaultOrBackupEncryption => {
"USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION"
}
EncryptionType::GoogleDefaultEncryption => "GOOGLE_DEFAULT_ENCRYPTION",
EncryptionType::CustomerManagedEncryption => {
"CUSTOMER_MANAGED_ENCRYPTION"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENCRYPTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
Some(Self::UseConfigDefaultOrBackupEncryption)
}
"GOOGLE_DEFAULT_ENCRYPTION" => Some(Self::GoogleDefaultEncryption),
"CUSTOMER_MANAGED_ENCRYPTION" => Some(Self::CustomerManagedEncryption),
_ => None,
}
}
}
}
/// Metadata type for the long-running operation returned by
/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RestoreDatabaseMetadata {
/// Name of the database being created and restored to.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The type of the restore source.
#[prost(enumeration = "RestoreSourceType", tag = "2")]
pub source_type: i32,
/// The progress of the
/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
/// operation.
#[prost(message, optional, tag = "4")]
pub progress: ::core::option::Option<OperationProgress>,
/// The time at which cancellation of this operation was received.
/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
/// starts asynchronous cancellation on a long-running operation. The server
/// makes a best effort to cancel the operation, but success is not guaranteed.
/// Clients can use
/// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
/// other methods to check whether the cancellation succeeded or whether the
/// operation completed despite cancellation. On successful cancellation,
/// the operation is not deleted; instead, it becomes an operation with
/// an [Operation.error][google.longrunning.Operation.error] value with a
/// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
/// `Code.CANCELLED`.
#[prost(message, optional, tag = "5")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
/// If exists, the name of the long-running operation that will be used to
/// track the post-restore optimization process to optimize the performance of
/// the restored database, and remove the dependency on the restore source.
/// The name is of the form
/// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
/// where the <database> is the name of database being created and restored to.
/// The metadata type of the long-running operation is
/// [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata].
/// This long-running operation will be automatically created by the system
/// after the RestoreDatabase long-running operation completes successfully.
/// This operation will not be created if the restore was not successful.
#[prost(string, tag = "6")]
pub optimize_database_operation_name: ::prost::alloc::string::String,
/// Information about the source used to restore the database, as specified by
/// `source` in
/// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
#[prost(oneof = "restore_database_metadata::SourceInfo", tags = "3")]
pub source_info: ::core::option::Option<restore_database_metadata::SourceInfo>,
}
/// Nested message and enum types in `RestoreDatabaseMetadata`.
pub mod restore_database_metadata {
/// Information about the source used to restore the database, as specified by
/// `source` in
/// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SourceInfo {
/// Information about the backup used to restore the database.
#[prost(message, tag = "3")]
BackupInfo(super::BackupInfo),
}
}
/// Metadata type for the long-running operation used to track the progress
/// of optimizations performed on a newly restored database. This long-running
/// operation is automatically created by the system after the successful
/// completion of a database restore, and cannot be cancelled.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OptimizeRestoredDatabaseMetadata {
/// Name of the restored database being optimized.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The progress of the post-restore optimizations.
#[prost(message, optional, tag = "2")]
pub progress: ::core::option::Option<OperationProgress>,
}
/// A Cloud Spanner database role.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatabaseRole {
/// Required. The name of the database role. Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>/databaseRoles/<role>`
/// where `<role>` is as specified in the `CREATE ROLE` DDL statement.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The request for
/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabaseRolesRequest {
/// Required. The database whose roles should be listed.
/// Values are of the form
/// `projects/<project>/instances/<instance>/databases/<database>`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Number of database roles to be returned in the response. If 0 or less,
/// defaults to the server's maximum allowed page size.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// If non-empty, `page_token` should contain a
/// [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]
/// from a previous
/// [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse].
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// The response for
/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabaseRolesResponse {
/// Database roles that matched the request.
#[prost(message, repeated, tag = "1")]
pub database_roles: ::prost::alloc::vec::Vec<DatabaseRole>,
/// `next_page_token` can be sent in a subsequent
/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]
/// call to fetch more of the matching roles.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Indicates the type of the restore source.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RestoreSourceType {
/// No restore associated.
TypeUnspecified = 0,
/// A backup was used as the source of the restore.
Backup = 1,
}
impl RestoreSourceType {
/// 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 {
RestoreSourceType::TypeUnspecified => "TYPE_UNSPECIFIED",
RestoreSourceType::Backup => "BACKUP",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::TypeUnspecified),
"BACKUP" => Some(Self::Backup),
_ => None,
}
}
}
/// Generated client implementations.
pub mod database_admin_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Cloud Spanner Database Admin API
///
/// The Cloud Spanner Database Admin API can be used to:
/// * create, drop, and list databases
/// * update the schema of pre-existing databases
/// * create, delete, copy and list backups for a database
/// * restore a database from an existing backup
#[derive(Debug, Clone)]
pub struct DatabaseAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> DatabaseAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> DatabaseAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
DatabaseAdminClient::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 Cloud Spanner databases.
pub async fn list_databases(
&mut self,
request: impl tonic::IntoRequest<super::ListDatabasesRequest>,
) -> std::result::Result<
tonic::Response<super::ListDatabasesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListDatabases",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a new Cloud Spanner database and starts to prepare it for serving.
/// The returned [long-running operation][google.longrunning.Operation] will
/// have a name of the format `<database_name>/operations/<operation_id>` and
/// can be used to track preparation of the database. The
/// [metadata][google.longrunning.Operation.metadata] field type is
/// [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
/// The [response][google.longrunning.Operation.response] field type is
/// [Database][google.spanner.admin.database.v1.Database], if successful.
pub async fn create_database(
&mut self,
request: impl tonic::IntoRequest<super::CreateDatabaseRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"CreateDatabase",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets the state of a Cloud Spanner database.
pub async fn get_database(
&mut self,
request: impl tonic::IntoRequest<super::GetDatabaseRequest>,
) -> std::result::Result<tonic::Response<super::Database>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"GetDatabase",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates a Cloud Spanner database. The returned
/// [long-running operation][google.longrunning.Operation] can be used to track
/// the progress of updating the database. If the named database does not
/// exist, returns `NOT_FOUND`.
///
/// While the operation is pending:
///
/// * The database's
/// [reconciling][google.spanner.admin.database.v1.Database.reconciling]
/// field is set to true.
/// * Cancelling the operation is best-effort. If the cancellation succeeds,
/// the operation metadata's
/// [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
/// is set, the updates are reverted, and the operation terminates with a
/// `CANCELLED` status.
/// * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
/// until the pending operation is done (returns successfully or with
/// error).
/// * Reading the database via the API continues to give the pre-request
/// values.
///
/// Upon completion of the returned operation:
///
/// * The new values are in effect and readable via the API.
/// * The database's
/// [reconciling][google.spanner.admin.database.v1.Database.reconciling]
/// field becomes false.
///
/// The returned [long-running operation][google.longrunning.Operation] will
/// have a name of the format
/// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
/// and can be used to track the database modification. The
/// [metadata][google.longrunning.Operation.metadata] field type is
/// [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
/// The [response][google.longrunning.Operation.response] field type is
/// [Database][google.spanner.admin.database.v1.Database], if successful.
pub async fn update_database(
&mut self,
request: impl tonic::IntoRequest<super::UpdateDatabaseRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"UpdateDatabase",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates the schema of a Cloud Spanner database by
/// creating/altering/dropping tables, columns, indexes, etc. The returned
/// [long-running operation][google.longrunning.Operation] will have a name of
/// the format `<database_name>/operations/<operation_id>` and can be used to
/// track execution of the schema change(s). The
/// [metadata][google.longrunning.Operation.metadata] field type is
/// [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
/// The operation has no response.
pub async fn update_database_ddl(
&mut self,
request: impl tonic::IntoRequest<super::UpdateDatabaseDdlRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"UpdateDatabaseDdl",
),
);
self.inner.unary(req, path, codec).await
}
/// Drops (aka deletes) a Cloud Spanner database.
/// Completed backups for the database will be retained according to their
/// `expire_time`.
/// Note: Cloud Spanner might continue to accept requests for a few seconds
/// after the database has been deleted.
pub async fn drop_database(
&mut self,
request: impl tonic::IntoRequest<super::DropDatabaseRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"DropDatabase",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the schema of a Cloud Spanner database as a list of formatted
/// DDL statements. This method does not show pending schema updates, those may
/// be queried using the [Operations][google.longrunning.Operations] API.
pub async fn get_database_ddl(
&mut self,
request: impl tonic::IntoRequest<super::GetDatabaseDdlRequest>,
) -> std::result::Result<
tonic::Response<super::GetDatabaseDdlResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"GetDatabaseDdl",
),
);
self.inner.unary(req, path, codec).await
}
/// Sets the access control policy on a database or backup resource.
/// Replaces any existing policy.
///
/// Authorization requires `spanner.databases.setIamPolicy`
/// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
/// For backups, authorization requires `spanner.backups.setIamPolicy`
/// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
pub async fn set_iam_policy(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::SetIamPolicyRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::iam::v1::Policy>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"SetIamPolicy",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets the access control policy for a database or backup resource.
/// Returns an empty policy if a database or backup exists but does not have a
/// policy set.
///
/// Authorization requires `spanner.databases.getIamPolicy` permission on
/// [resource][google.iam.v1.GetIamPolicyRequest.resource].
/// For backups, authorization requires `spanner.backups.getIamPolicy`
/// permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
pub async fn get_iam_policy(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::GetIamPolicyRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::iam::v1::Policy>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"GetIamPolicy",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns permissions that the caller has on the specified database or backup
/// resource.
///
/// Attempting this RPC on a non-existent Cloud Spanner database will
/// result in a NOT_FOUND error if the user has
/// `spanner.databases.list` permission on the containing Cloud
/// Spanner instance. Otherwise returns an empty set of permissions.
/// Calling this method on a backup that does not exist will
/// result in a NOT_FOUND error if the user has
/// `spanner.backups.list` permission on the containing instance.
pub async fn test_iam_permissions(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::TestIamPermissionsRequest,
>,
) -> std::result::Result<
tonic::Response<
super::super::super::super::super::iam::v1::TestIamPermissionsResponse,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"TestIamPermissions",
),
);
self.inner.unary(req, path, codec).await
}
/// Starts creating a new Cloud Spanner Backup.
/// The returned backup [long-running operation][google.longrunning.Operation]
/// will have a name of the format
/// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
/// and can be used to track creation of the backup. The
/// [metadata][google.longrunning.Operation.metadata] field type is
/// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
/// The [response][google.longrunning.Operation.response] field type is
/// [Backup][google.spanner.admin.database.v1.Backup], if successful.
/// Cancelling the returned operation will stop the creation and delete the
/// backup. There can be only one pending backup creation per database. Backup
/// creation of different databases can run concurrently.
pub async fn create_backup(
&mut self,
request: impl tonic::IntoRequest<super::CreateBackupRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"CreateBackup",
),
);
self.inner.unary(req, path, codec).await
}
/// Starts copying a Cloud Spanner Backup.
/// The returned backup [long-running operation][google.longrunning.Operation]
/// will have a name of the format
/// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
/// and can be used to track copying of the backup. The operation is associated
/// with the destination backup.
/// The [metadata][google.longrunning.Operation.metadata] field type is
/// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
/// The [response][google.longrunning.Operation.response] field type is
/// [Backup][google.spanner.admin.database.v1.Backup], if successful.
/// Cancelling the returned operation will stop the copying and delete the
/// destination backup. Concurrent CopyBackup requests can run on the same
/// source backup.
pub async fn copy_backup(
&mut self,
request: impl tonic::IntoRequest<super::CopyBackupRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"CopyBackup",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets metadata on a pending or completed
/// [Backup][google.spanner.admin.database.v1.Backup].
pub async fn get_backup(
&mut self,
request: impl tonic::IntoRequest<super::GetBackupRequest>,
) -> std::result::Result<tonic::Response<super::Backup>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"GetBackup",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates a pending or completed
/// [Backup][google.spanner.admin.database.v1.Backup].
pub async fn update_backup(
&mut self,
request: impl tonic::IntoRequest<super::UpdateBackupRequest>,
) -> std::result::Result<tonic::Response<super::Backup>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"UpdateBackup",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes a pending or completed
/// [Backup][google.spanner.admin.database.v1.Backup].
pub async fn delete_backup(
&mut self,
request: impl tonic::IntoRequest<super::DeleteBackupRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"DeleteBackup",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists completed and pending backups.
/// Backups returned are ordered by `create_time` in descending order,
/// starting from the most recent `create_time`.
pub async fn list_backups(
&mut self,
request: impl tonic::IntoRequest<super::ListBackupsRequest>,
) -> std::result::Result<
tonic::Response<super::ListBackupsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListBackups",
),
);
self.inner.unary(req, path, codec).await
}
/// Create a new database by restoring from a completed backup. The new
/// database must be in the same project and in an instance with the same
/// instance configuration as the instance containing
/// the backup. The returned database [long-running
/// operation][google.longrunning.Operation] has a name of the format
/// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
/// and can be used to track the progress of the operation, and to cancel it.
/// The [metadata][google.longrunning.Operation.metadata] field type is
/// [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
/// The [response][google.longrunning.Operation.response] type
/// is [Database][google.spanner.admin.database.v1.Database], if
/// successful. Cancelling the returned operation will stop the restore and
/// delete the database.
/// There can be only one database being restored into an instance at a time.
/// Once the restore operation completes, a new restore operation can be
/// initiated, without waiting for the optimize operation associated with the
/// first restore to complete.
pub async fn restore_database(
&mut self,
request: impl tonic::IntoRequest<super::RestoreDatabaseRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"RestoreDatabase",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists database [longrunning-operations][google.longrunning.Operation].
/// A database operation has a name of the form
/// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`.
/// The long-running operation
/// [metadata][google.longrunning.Operation.metadata] field type
/// `metadata.type_url` describes the type of the metadata. Operations returned
/// include those that have completed/failed/canceled within the last 7 days,
/// and pending operations.
pub async fn list_database_operations(
&mut self,
request: impl tonic::IntoRequest<super::ListDatabaseOperationsRequest>,
) -> std::result::Result<
tonic::Response<super::ListDatabaseOperationsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListDatabaseOperations",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists the backup [long-running operations][google.longrunning.Operation] in
/// the given instance. A backup operation has a name of the form
/// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`.
/// The long-running operation
/// [metadata][google.longrunning.Operation.metadata] field type
/// `metadata.type_url` describes the type of the metadata. Operations returned
/// include those that have completed/failed/canceled within the last 7 days,
/// and pending operations. Operations returned are ordered by
/// `operation.metadata.value.progress.start_time` in descending order starting
/// from the most recently started operation.
pub async fn list_backup_operations(
&mut self,
request: impl tonic::IntoRequest<super::ListBackupOperationsRequest>,
) -> std::result::Result<
tonic::Response<super::ListBackupOperationsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListBackupOperations",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists Cloud Spanner database roles.
pub async fn list_database_roles(
&mut self,
request: impl tonic::IntoRequest<super::ListDatabaseRolesRequest>,
) -> std::result::Result<
tonic::Response<super::ListDatabaseRolesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListDatabaseRoles",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a new backup schedule.
pub async fn create_backup_schedule(
&mut self,
request: impl tonic::IntoRequest<super::CreateBackupScheduleRequest>,
) -> std::result::Result<tonic::Response<super::BackupSchedule>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"CreateBackupSchedule",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets backup schedule for the input schedule name.
pub async fn get_backup_schedule(
&mut self,
request: impl tonic::IntoRequest<super::GetBackupScheduleRequest>,
) -> std::result::Result<tonic::Response<super::BackupSchedule>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"GetBackupSchedule",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates a backup schedule.
pub async fn update_backup_schedule(
&mut self,
request: impl tonic::IntoRequest<super::UpdateBackupScheduleRequest>,
) -> std::result::Result<tonic::Response<super::BackupSchedule>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"UpdateBackupSchedule",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes a backup schedule.
pub async fn delete_backup_schedule(
&mut self,
request: impl tonic::IntoRequest<super::DeleteBackupScheduleRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"DeleteBackupSchedule",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists all the backup schedules for the database.
pub async fn list_backup_schedules(
&mut self,
request: impl tonic::IntoRequest<super::ListBackupSchedulesRequest>,
) -> std::result::Result<
tonic::Response<super::ListBackupSchedulesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.spanner.admin.database.v1.DatabaseAdmin",
"ListBackupSchedules",
),
);
self.inner.unary(req, path, codec).await
}
}
}