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 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127
|
// Generated service client for heroku API.
//
// To be able to interact with this API, you have to
// create a new service:
//
// s := heroku.NewService(nil)
//
// The Service struct has all the methods you need
// to interact with heroku API.
//
package v5
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/google/go-querystring/query"
"io"
"net/http"
"reflect"
"runtime"
"strings"
"time"
)
var _ = time.Second
const (
Version = "v5"
DefaultUserAgent = "heroku/" + Version + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")"
DefaultURL = "https://api.heroku.com"
)
// Service represents your API.
type Service struct {
client *http.Client
URL string
}
// NewService creates a Service using the given, if none is provided
// it uses http.DefaultClient.
func NewService(c *http.Client) *Service {
if c == nil {
c = http.DefaultClient
}
return &Service{
client: c,
URL: DefaultURL,
}
}
// NewRequest generates an HTTP request, but does not perform the request.
func (s *Service) NewRequest(ctx context.Context, method, path string, body interface{}, q interface{}) (*http.Request, error) {
var ctype string
var rbody io.Reader
switch t := body.(type) {
case nil:
case string:
rbody = bytes.NewBufferString(t)
case io.Reader:
rbody = t
default:
v := reflect.ValueOf(body)
if !v.IsValid() {
break
}
if v.Type().Kind() == reflect.Ptr {
v = reflect.Indirect(v)
if !v.IsValid() {
break
}
}
j, err := json.Marshal(body)
if err != nil {
return nil, err
}
rbody = bytes.NewReader(j)
ctype = "application/json"
}
req, err := http.NewRequest(method, s.URL+path, rbody)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if q != nil {
v, err := query.Values(q)
if err != nil {
return nil, err
}
query := v.Encode()
if req.URL.RawQuery != "" && query != "" {
req.URL.RawQuery += "&"
}
req.URL.RawQuery += query
}
req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", DefaultUserAgent)
if ctype != "" {
req.Header.Set("Content-Type", ctype)
}
return req, nil
}
// Do sends a request and decodes the response into v.
func (s *Service) Do(ctx context.Context, v interface{}, method, path string, body interface{}, q interface{}, lr *ListRange) error {
req, err := s.NewRequest(ctx, method, path, body, q)
if err != nil {
return err
}
if lr != nil {
lr.SetHeader(req)
}
resp, err := s.client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
switch t := v.(type) {
case nil:
case io.Writer:
_, err = io.Copy(t, resp.Body)
default:
err = json.NewDecoder(resp.Body).Decode(v)
}
return err
}
// Get sends a GET request and decodes the response into v.
func (s *Service) Get(ctx context.Context, v interface{}, path string, query interface{}, lr *ListRange) error {
return s.Do(ctx, v, "GET", path, nil, query, lr)
}
// Patch sends a Path request and decodes the response into v.
func (s *Service) Patch(ctx context.Context, v interface{}, path string, body interface{}) error {
return s.Do(ctx, v, "PATCH", path, body, nil, nil)
}
// Post sends a POST request and decodes the response into v.
func (s *Service) Post(ctx context.Context, v interface{}, path string, body interface{}) error {
return s.Do(ctx, v, "POST", path, body, nil, nil)
}
// Put sends a PUT request and decodes the response into v.
func (s *Service) Put(ctx context.Context, v interface{}, path string, body interface{}) error {
return s.Do(ctx, v, "PUT", path, body, nil, nil)
}
// Delete sends a DELETE request.
func (s *Service) Delete(ctx context.Context, v interface{}, path string) error {
return s.Do(ctx, v, "DELETE", path, nil, nil, nil)
}
// ListRange describes a range.
type ListRange struct {
Field string
Max int
Descending bool
FirstID string
LastID string
}
// SetHeader set headers on the given Request.
func (lr *ListRange) SetHeader(req *http.Request) {
var hdrval string
if lr.Field != "" {
hdrval += lr.Field + " "
}
hdrval += lr.FirstID + ".." + lr.LastID
params := make([]string, 0, 2)
if lr.Max != 0 {
params = append(params, fmt.Sprintf("max=%d", lr.Max))
}
if lr.Descending {
params = append(params, "order=desc")
}
if len(params) > 0 {
hdrval += fmt.Sprintf("; %s", strings.Join(params, ","))
}
req.Header.Set("Range", hdrval)
return
}
// Bool allocates a new int value returns a pointer to it.
func Bool(v bool) *bool {
p := new(bool)
*p = v
return p
}
// Int allocates a new int value returns a pointer to it.
func Int(v int) *int {
p := new(int)
*p = v
return p
}
// Float64 allocates a new float64 value returns a pointer to it.
func Float64(v float64) *float64 {
p := new(float64)
*p = v
return p
}
// String allocates a new string value returns a pointer to it.
func String(v string) *string {
p := new(string)
*p = v
return p
}
// An account represents an individual signed up to use the Heroku
// platform.
type Account struct {
AllowTracking bool `json:"allow_tracking" url:"allow_tracking,key"` // whether to allow third party web activity tracking
Beta bool `json:"beta" url:"beta,key"` // whether allowed to utilize beta Heroku features
CountryOfResidence *string `json:"country_of_residence" url:"country_of_residence,key"` // country where account owner resides
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account was created
DefaultOrganization *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"default_organization" url:"default_organization,key"` // team selected by default
DefaultTeam *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"default_team" url:"default_team,key"` // team selected by default
DelinquentAt *time.Time `json:"delinquent_at" url:"delinquent_at,key"` // when account became delinquent
Email string `json:"email" url:"email,key"` // unique email address of account
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of an account
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
Organization struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"`
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
Team struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"`
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider details for federated users.
LastLogin *time.Time `json:"last_login" url:"last_login,key"` // when account last authorized with Heroku
Name *string `json:"name" url:"name,key"` // full name of the account owner
SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
SuspendedAt *time.Time `json:"suspended_at" url:"suspended_at,key"` // when account was suspended
TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether two-factor auth is enabled on the account
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account was updated
Verified bool `json:"verified" url:"verified,key"` // whether account has been verified with billing information
}
// Info for account.
func (s *Service) AccountInfo(ctx context.Context) (*Account, error) {
var account Account
return &account, s.Get(ctx, &account, fmt.Sprintf("/account"), nil, nil)
}
type AccountUpdateOpts struct {
AllowTracking *bool `json:"allow_tracking,omitempty" url:"allow_tracking,omitempty,key"` // whether to allow third party web activity tracking
Beta *bool `json:"beta,omitempty" url:"beta,omitempty,key"` // whether allowed to utilize beta Heroku features
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // full name of the account owner
}
// Update account.
func (s *Service) AccountUpdate(ctx context.Context, o AccountUpdateOpts) (*Account, error) {
var account Account
return &account, s.Patch(ctx, &account, fmt.Sprintf("/account"), o)
}
// Delete account. Note that this action cannot be undone. Note: This
// endpoint requires the HTTP_HEROKU_PASSWORD or
// HTTP_HEROKU_PASSWORD_BASE64 header be set correctly for the user
// account.
func (s *Service) AccountDelete(ctx context.Context) (*Account, error) {
var account Account
return &account, s.Delete(ctx, &account, fmt.Sprintf("/account"))
}
// Info for account.
func (s *Service) AccountInfoByUser(ctx context.Context, accountIdentity string) (*Account, error) {
var account Account
return &account, s.Get(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity), nil, nil)
}
type AccountUpdateByUserOpts struct {
AllowTracking *bool `json:"allow_tracking,omitempty" url:"allow_tracking,omitempty,key"` // whether to allow third party web activity tracking
Beta *bool `json:"beta,omitempty" url:"beta,omitempty,key"` // whether allowed to utilize beta Heroku features
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // full name of the account owner
}
// Update account.
func (s *Service) AccountUpdateByUser(ctx context.Context, accountIdentity string, o AccountUpdateByUserOpts) (*Account, error) {
var account Account
return &account, s.Patch(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity), o)
}
// Delete account. Note that this action cannot be undone. Note: This
// endpoint requires the HTTP_HEROKU_PASSWORD or
// HTTP_HEROKU_PASSWORD_BASE64 header be set correctly for the user
// account.
func (s *Service) AccountDeleteByUser(ctx context.Context, accountIdentity string) (*Account, error) {
var account Account
return &account, s.Delete(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity))
}
// An account feature represents a Heroku labs capability that can be
// enabled or disabled for an account on Heroku.
type AccountFeature struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account feature was created
Description string `json:"description" url:"description,key"` // description of account feature
DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of account feature
Enabled bool `json:"enabled" url:"enabled,key"` // whether or not account feature has been enabled
FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
ID string `json:"id" url:"id,key"` // unique identifier of account feature
Name string `json:"name" url:"name,key"` // unique name of account feature
State string `json:"state" url:"state,key"` // state of account feature
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account feature was updated
}
// Info for an existing account feature.
func (s *Service) AccountFeatureInfo(ctx context.Context, accountFeatureIdentity string) (*AccountFeature, error) {
var accountFeature AccountFeature
return &accountFeature, s.Get(ctx, &accountFeature, fmt.Sprintf("/account/features/%v", accountFeatureIdentity), nil, nil)
}
type AccountFeatureListResult []AccountFeature
// List existing account features.
func (s *Service) AccountFeatureList(ctx context.Context, lr *ListRange) (AccountFeatureListResult, error) {
var accountFeature AccountFeatureListResult
return accountFeature, s.Get(ctx, &accountFeature, fmt.Sprintf("/account/features"), nil, lr)
}
type AccountFeatureUpdateOpts struct {
Enabled bool `json:"enabled" url:"enabled,key"` // whether or not account feature has been enabled
}
// Update an existing account feature.
func (s *Service) AccountFeatureUpdate(ctx context.Context, accountFeatureIdentity string, o AccountFeatureUpdateOpts) (*AccountFeature, error) {
var accountFeature AccountFeature
return &accountFeature, s.Patch(ctx, &accountFeature, fmt.Sprintf("/account/features/%v", accountFeatureIdentity), o)
}
// Add-ons represent add-ons that have been provisioned and attached to
// one or more apps.
type AddOn struct {
Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
AddonService struct {
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // identity of add-on service
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // billing application associated with this add-on
BilledPrice *struct {
Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
Unit string `json:"unit" url:"unit,key"` // unit of price for plan
} `json:"billed_price" url:"billed_price,key"` // billed price
BillingEntity struct {
ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
Name string `json:"name" url:"name,key"` // name of the billing entity
Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
} `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
Plan struct {
ID string `json:"id" url:"id,key"` // unique identifier of this plan
Name string `json:"name" url:"name,key"` // unique name of this plan
} `json:"plan" url:"plan,key"` // identity of add-on plan
ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
}
type AddOnListResult []AddOn
// List all existing add-ons.
func (s *Service) AddOnList(ctx context.Context, lr *ListRange) (AddOnListResult, error) {
var addOn AddOnListResult
return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/addons"), nil, lr)
}
// Info for an existing add-on.
func (s *Service) AddOnInfo(ctx context.Context, addOnIdentity string) (*AddOn, error) {
var addOn AddOn
return &addOn, s.Get(ctx, &addOn, fmt.Sprintf("/addons/%v", addOnIdentity), nil, nil)
}
type AddOnCreateOpts struct {
Attachment *struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name for this add-on attachment to this app
} `json:"attachment,omitempty" url:"attachment,omitempty,key"` // name for add-on's initial attachment
Config map[string]string `json:"config,omitempty" url:"config,omitempty,key"` // custom add-on provisioning options
Confirm *string `json:"confirm,omitempty" url:"confirm,omitempty,key"` // name of billing entity for confirmation
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // globally unique name of the add-on
Plan string `json:"plan" url:"plan,key"` // unique identifier of this plan
}
// Create a new add-on.
func (s *Service) AddOnCreate(ctx context.Context, appIdentity string, o AddOnCreateOpts) (*AddOn, error) {
var addOn AddOn
return &addOn, s.Post(ctx, &addOn, fmt.Sprintf("/apps/%v/addons", appIdentity), o)
}
// Delete an existing add-on.
func (s *Service) AddOnDelete(ctx context.Context, appIdentity string, addOnIdentity string) (*AddOn, error) {
var addOn AddOn
return &addOn, s.Delete(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity))
}
// Info for an existing add-on.
func (s *Service) AddOnInfoByApp(ctx context.Context, appIdentity string, addOnIdentity string) (*AddOn, error) {
var addOn AddOn
return &addOn, s.Get(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity), nil, nil)
}
type AddOnListByAppResult []AddOn
// List existing add-ons for an app.
func (s *Service) AddOnListByApp(ctx context.Context, appIdentity string, lr *ListRange) (AddOnListByAppResult, error) {
var addOn AddOnListByAppResult
return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/apps/%v/addons", appIdentity), nil, lr)
}
type AddOnUpdateOpts struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // globally unique name of the add-on
Plan string `json:"plan" url:"plan,key"` // unique identifier of this plan
}
// Change add-on plan. Some add-ons may not support changing plans. In
// that case, an error will be returned.
func (s *Service) AddOnUpdate(ctx context.Context, appIdentity string, addOnIdentity string, o AddOnUpdateOpts) (*AddOn, error) {
var addOn AddOn
return &addOn, s.Patch(ctx, &addOn, fmt.Sprintf("/apps/%v/addons/%v", appIdentity, addOnIdentity), o)
}
type AddOnListByUserResult []AddOn
// List all existing add-ons a user has access to
func (s *Service) AddOnListByUser(ctx context.Context, accountIdentity string, lr *ListRange) (AddOnListByUserResult, error) {
var addOn AddOnListByUserResult
return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/users/%v/addons", accountIdentity), nil, lr)
}
type AddOnListByTeamResult []AddOn
// List add-ons used across all Team apps
func (s *Service) AddOnListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (AddOnListByTeamResult, error) {
var addOn AddOnListByTeamResult
return addOn, s.Get(ctx, &addOn, fmt.Sprintf("/teams/%v/addons", teamIdentity), nil, lr)
}
type AddOnResolutionOpts struct {
Addon string `json:"addon" url:"addon,key"` // globally unique name of the add-on
AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // unique name of this add-on-service
App *string `json:"app,omitempty" url:"app,omitempty,key"` // unique name of app
}
type AddOnResolutionResult []AddOn
// Resolve an add-on from a name, optionally passing an app name. If
// there are matches it returns at least one add-on (exact match) or
// many.
func (s *Service) AddOnResolution(ctx context.Context, o AddOnResolutionOpts) (AddOnResolutionResult, error) {
var addOn AddOnResolutionResult
return addOn, s.Post(ctx, &addOn, fmt.Sprintf("/actions/addons/resolve"), o)
}
// Add-on Actions are lifecycle operations for add-on provisioning and
// deprovisioning. They allow add-on providers to (de)provision add-ons
// in the background and then report back when (de)provisioning is
// complete.
type AddOnAction struct{}
type AddOnActionProvisionResult struct {
Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
AddonService struct {
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // identity of add-on service
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // billing application associated with this add-on
BilledPrice *struct {
Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
Unit string `json:"unit" url:"unit,key"` // unit of price for plan
} `json:"billed_price" url:"billed_price,key"` // billed price
BillingEntity struct {
ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
Name string `json:"name" url:"name,key"` // name of the billing entity
Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
} `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
Plan struct {
ID string `json:"id" url:"id,key"` // unique identifier of this plan
Name string `json:"name" url:"name,key"` // unique name of this plan
} `json:"plan" url:"plan,key"` // identity of add-on plan
ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
}
// Mark an add-on as provisioned for use.
func (s *Service) AddOnActionProvision(ctx context.Context, addOnIdentity string) (*AddOnActionProvisionResult, error) {
var addOnAction AddOnActionProvisionResult
return &addOnAction, s.Post(ctx, &addOnAction, fmt.Sprintf("/addons/%v/actions/provision", addOnIdentity), nil)
}
type AddOnActionDeprovisionResult struct {
Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
AddonService struct {
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // identity of add-on service
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // billing application associated with this add-on
BilledPrice *struct {
Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
Unit string `json:"unit" url:"unit,key"` // unit of price for plan
} `json:"billed_price" url:"billed_price,key"` // billed price
BillingEntity struct {
ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
Name string `json:"name" url:"name,key"` // name of the billing entity
Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
} `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
Plan struct {
ID string `json:"id" url:"id,key"` // unique identifier of this plan
Name string `json:"name" url:"name,key"` // unique name of this plan
} `json:"plan" url:"plan,key"` // identity of add-on plan
ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
}
// Mark an add-on as deprovisioned.
func (s *Service) AddOnActionDeprovision(ctx context.Context, addOnIdentity string) (*AddOnActionDeprovisionResult, error) {
var addOnAction AddOnActionDeprovisionResult
return &addOnAction, s.Post(ctx, &addOnAction, fmt.Sprintf("/addons/%v/actions/deprovision", addOnIdentity), nil)
}
// An add-on attachment represents a connection between an app and an
// add-on that it has been given access to.
type AddOnAttachment struct {
Addon struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // billing application associated with this add-on
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // application that is attached to add-on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on attachment was created
ID string `json:"id" url:"id,key"` // unique identifier of this add-on attachment
LogInputURL *string `json:"log_input_url" url:"log_input_url,key"` // URL for add-on partners to write to an add-on's logs
Name string `json:"name" url:"name,key"` // unique name for this add-on attachment to this app
Namespace *string `json:"namespace" url:"namespace,key"` // attachment namespace
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on attachment was updated
WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on in attached app context
}
type AddOnAttachmentCreateOpts struct {
Addon string `json:"addon" url:"addon,key"` // unique identifier of add-on
App string `json:"app" url:"app,key"` // unique identifier of app
Confirm *string `json:"confirm,omitempty" url:"confirm,omitempty,key"` // name of owning app for confirmation
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name for this add-on attachment to this app
Namespace *string `json:"namespace,omitempty" url:"namespace,omitempty,key"` // attachment namespace
}
// Create a new add-on attachment.
func (s *Service) AddOnAttachmentCreate(ctx context.Context, o AddOnAttachmentCreateOpts) (*AddOnAttachment, error) {
var addOnAttachment AddOnAttachment
return &addOnAttachment, s.Post(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments"), o)
}
// Delete an existing add-on attachment.
func (s *Service) AddOnAttachmentDelete(ctx context.Context, addOnAttachmentIdentity string) (*AddOnAttachment, error) {
var addOnAttachment AddOnAttachment
return &addOnAttachment, s.Delete(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments/%v", addOnAttachmentIdentity))
}
// Info for existing add-on attachment.
func (s *Service) AddOnAttachmentInfo(ctx context.Context, addOnAttachmentIdentity string) (*AddOnAttachment, error) {
var addOnAttachment AddOnAttachment
return &addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments/%v", addOnAttachmentIdentity), nil, nil)
}
type AddOnAttachmentListResult []AddOnAttachment
// List existing add-on attachments.
func (s *Service) AddOnAttachmentList(ctx context.Context, lr *ListRange) (AddOnAttachmentListResult, error) {
var addOnAttachment AddOnAttachmentListResult
return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addon-attachments"), nil, lr)
}
type AddOnAttachmentListByAddOnResult []AddOnAttachment
// List existing add-on attachments for an add-on.
func (s *Service) AddOnAttachmentListByAddOn(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnAttachmentListByAddOnResult, error) {
var addOnAttachment AddOnAttachmentListByAddOnResult
return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/addons/%v/addon-attachments", addOnIdentity), nil, lr)
}
type AddOnAttachmentListByAppResult []AddOnAttachment
// List existing add-on attachments for an app.
func (s *Service) AddOnAttachmentListByApp(ctx context.Context, appIdentity string, lr *ListRange) (AddOnAttachmentListByAppResult, error) {
var addOnAttachment AddOnAttachmentListByAppResult
return addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/apps/%v/addon-attachments", appIdentity), nil, lr)
}
// Info for existing add-on attachment for an app.
func (s *Service) AddOnAttachmentInfoByApp(ctx context.Context, appIdentity string, addOnAttachmentScopedIdentity string) (*AddOnAttachment, error) {
var addOnAttachment AddOnAttachment
return &addOnAttachment, s.Get(ctx, &addOnAttachment, fmt.Sprintf("/apps/%v/addon-attachments/%v", appIdentity, addOnAttachmentScopedIdentity), nil, nil)
}
type AddOnAttachmentResolutionOpts struct {
AddonAttachment string `json:"addon_attachment" url:"addon_attachment,key"` // unique name for this add-on attachment to this app
AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // unique name of this add-on-service
App *string `json:"app,omitempty" url:"app,omitempty,key"` // unique name of app
}
type AddOnAttachmentResolutionResult []AddOnAttachment
// Resolve an add-on attachment from a name, optionally passing an app
// name. If there are matches it returns at least one add-on attachment
// (exact match) or many.
func (s *Service) AddOnAttachmentResolution(ctx context.Context, o AddOnAttachmentResolutionOpts) (AddOnAttachmentResolutionResult, error) {
var addOnAttachment AddOnAttachmentResolutionResult
return addOnAttachment, s.Post(ctx, &addOnAttachment, fmt.Sprintf("/actions/addon-attachments/resolve"), o)
}
// Configuration of an Add-on
type AddOnConfig struct {
Name string `json:"name" url:"name,key"` // unique name of the config
Value *string `json:"value" url:"value,key"` // value of the config
}
type AddOnConfigListResult []AddOnConfig
// Get an add-on's config. Accessible by customers with access and by
// the add-on partner providing this add-on.
func (s *Service) AddOnConfigList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnConfigListResult, error) {
var addOnConfig AddOnConfigListResult
return addOnConfig, s.Get(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), nil, lr)
}
type AddOnConfigUpdateOpts struct {
Config []*struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of the config
Value *string `json:"value,omitempty" url:"value,omitempty,key"` // value of the config
} `json:"config,omitempty" url:"config,omitempty,key"`
}
type AddOnConfigUpdateResult []AddOnConfig
// Update an add-on's config. Can only be accessed by the add-on partner
// providing this add-on.
func (s *Service) AddOnConfigUpdate(ctx context.Context, addOnIdentity string, o AddOnConfigUpdateOpts) (AddOnConfigUpdateResult, error) {
var addOnConfig AddOnConfigUpdateResult
return addOnConfig, s.Patch(ctx, &addOnConfig, fmt.Sprintf("/addons/%v/config", addOnIdentity), o)
}
// Add-on Plan Actions are Provider functionality for specific add-on
// installations
type AddOnPlanAction struct {
Action string `json:"action" url:"action,key"` // identifier of the action to take that is sent via SSO
ID string `json:"id" url:"id,key"` // a unique identifier
Label string `json:"label" url:"label,key"` // the display text shown in Dashboard
RequiresOwner bool `json:"requires_owner" url:"requires_owner,key"` // if the action requires the user to own the app
URL string `json:"url" url:"url,key"` // absolute URL to use instead of an action
}
// Add-on region capabilities represent the relationship between an
// Add-on Service and a specific Region. Only Beta and GA add-ons are
// returned by these endpoints.
type AddOnRegionCapability struct {
AddonService struct {
CliPluginName *string `json:"cli_plugin_name" url:"cli_plugin_name,key"` // npm package name of the add-on service's Heroku CLI plugin
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on-service was created
HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
State string `json:"state" url:"state,key"` // release status for add-on service
SupportsMultipleInstallations bool `json:"supports_multiple_installations" url:"supports_multiple_installations,key"` // whether or not apps can have access to more than one instance of this
// add-on at the same time
SupportsSharing bool `json:"supports_sharing" url:"supports_sharing,key"` // whether or not apps can have access to add-ons billed to a different
// app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on-service was updated
} `json:"addon_service" url:"addon_service,key"` // Add-on services represent add-ons that may be provisioned for apps.
// Endpoints under add-on services can be accessed without
// authentication.
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-region-capability
Region struct {
Country string `json:"country" url:"country,key"` // country where the region exists
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when region was created
Description string `json:"description" url:"description,key"` // description of region
ID string `json:"id" url:"id,key"` // unique identifier of region
Locale string `json:"locale" url:"locale,key"` // area in the country where the region exists
Name string `json:"name" url:"name,key"` // unique name of region
PrivateCapable bool `json:"private_capable" url:"private_capable,key"` // whether or not region is available for creating a Private Space
Provider struct {
Name string `json:"name" url:"name,key"` // name of provider
Region string `json:"region" url:"region,key"` // region name used by provider
} `json:"provider" url:"provider,key"` // provider of underlying substrate
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when region was updated
} `json:"region" url:"region,key"` // A region represents a geographic location in which your application
// may run.
SupportsPrivateNetworking bool `json:"supports_private_networking" url:"supports_private_networking,key"` // whether the add-on can be installed to a Space
}
type AddOnRegionCapabilityListResult []AddOnRegionCapability
// List all existing add-on region capabilities.
func (s *Service) AddOnRegionCapabilityList(ctx context.Context, lr *ListRange) (AddOnRegionCapabilityListResult, error) {
var addOnRegionCapability AddOnRegionCapabilityListResult
return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/addon-region-capabilities"), nil, lr)
}
type AddOnRegionCapabilityListByAddOnServiceResult []AddOnRegionCapability
// List existing add-on region capabilities for an add-on-service
func (s *Service) AddOnRegionCapabilityListByAddOnService(ctx context.Context, addOnServiceIdentity string, lr *ListRange) (AddOnRegionCapabilityListByAddOnServiceResult, error) {
var addOnRegionCapability AddOnRegionCapabilityListByAddOnServiceResult
return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/addon-services/%v/region-capabilities", addOnServiceIdentity), nil, lr)
}
type AddOnRegionCapabilityListByRegionResult []AddOnRegionCapability
// List existing add-on region capabilities for a region.
func (s *Service) AddOnRegionCapabilityListByRegion(ctx context.Context, regionIdentity string, lr *ListRange) (AddOnRegionCapabilityListByRegionResult, error) {
var addOnRegionCapability AddOnRegionCapabilityListByRegionResult
return addOnRegionCapability, s.Get(ctx, &addOnRegionCapability, fmt.Sprintf("/regions/%v/addon-region-capabilities", regionIdentity), nil, lr)
}
// Add-on services represent add-ons that may be provisioned for apps.
// Endpoints under add-on services can be accessed without
// authentication.
type AddOnService struct {
CliPluginName *string `json:"cli_plugin_name" url:"cli_plugin_name,key"` // npm package name of the add-on service's Heroku CLI plugin
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on-service was created
HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
State string `json:"state" url:"state,key"` // release status for add-on service
SupportsMultipleInstallations bool `json:"supports_multiple_installations" url:"supports_multiple_installations,key"` // whether or not apps can have access to more than one instance of this
// add-on at the same time
SupportsSharing bool `json:"supports_sharing" url:"supports_sharing,key"` // whether or not apps can have access to add-ons billed to a different
// app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on-service was updated
}
// Info for existing add-on-service.
func (s *Service) AddOnServiceInfo(ctx context.Context, addOnServiceIdentity string) (*AddOnService, error) {
var addOnService AddOnService
return &addOnService, s.Get(ctx, &addOnService, fmt.Sprintf("/addon-services/%v", addOnServiceIdentity), nil, nil)
}
type AddOnServiceListResult []AddOnService
// List existing add-on-services.
func (s *Service) AddOnServiceList(ctx context.Context, lr *ListRange) (AddOnServiceListResult, error) {
var addOnService AddOnServiceListResult
return addOnService, s.Get(ctx, &addOnService, fmt.Sprintf("/addon-services"), nil, lr)
}
// Represents the details of a webhook subscription
type AddOnWebhook struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
type AddOnWebhookCreateOpts struct {
Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
// webhook notifications
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
// requests (the signature is included in the request’s
// `Heroku-Webhook-Hmac-SHA256` header)
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
type AddOnWebhookCreateResult struct {
Addon struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Create an add-on webhook subscription. Can only be accessed by the
// add-on partner providing this add-on.
func (s *Service) AddOnWebhookCreate(ctx context.Context, addOnIdentity string, o AddOnWebhookCreateOpts) (*AddOnWebhookCreateResult, error) {
var addOnWebhook AddOnWebhookCreateResult
return &addOnWebhook, s.Post(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks", addOnIdentity), o)
}
type AddOnWebhookDeleteResult struct {
Addon struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Removes an add-on webhook subscription. Can only be accessed by the
// add-on partner providing this add-on.
func (s *Service) AddOnWebhookDelete(ctx context.Context, addOnIdentity string, appWebhookIdentity string) (*AddOnWebhookDeleteResult, error) {
var addOnWebhook AddOnWebhookDeleteResult
return &addOnWebhook, s.Delete(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity))
}
type AddOnWebhookInfoResult struct {
Addon struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Returns the info for an add-on webhook subscription. Can only be
// accessed by the add-on partner providing this add-on.
func (s *Service) AddOnWebhookInfo(ctx context.Context, addOnIdentity string, appWebhookIdentity string) (*AddOnWebhookInfoResult, error) {
var addOnWebhook AddOnWebhookInfoResult
return &addOnWebhook, s.Get(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity), nil, nil)
}
type AddOnWebhookListResult []struct {
Addon struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// List all webhook subscriptions for a particular add-on. Can only be
// accessed by the add-on partner providing this add-on.
func (s *Service) AddOnWebhookList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookListResult, error) {
var addOnWebhook AddOnWebhookListResult
return addOnWebhook, s.Get(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks", addOnIdentity), nil, lr)
}
type AddOnWebhookUpdateOpts struct {
Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
// webhook notifications
Include []*string `json:"include,omitempty" url:"include,omitempty,key"` // the entities that the subscription provides notifications for
Level *string `json:"level,omitempty" url:"level,omitempty,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
// requests (the signature is included in the request’s
// `Heroku-Webhook-Hmac-SHA256` header)
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL where the webhook's notification requests are sent
}
type AddOnWebhookUpdateResult struct {
Addon struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // identity of add-on. Only used for add-on partner webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Updates the details of an add-on webhook subscription. Can only be
// accessed by the add-on partner providing this add-on.
func (s *Service) AddOnWebhookUpdate(ctx context.Context, addOnIdentity string, appWebhookIdentity string, o AddOnWebhookUpdateOpts) (*AddOnWebhookUpdateResult, error) {
var addOnWebhook AddOnWebhookUpdateResult
return &addOnWebhook, s.Patch(ctx, &addOnWebhook, fmt.Sprintf("/addons/%v/webhooks/%v", addOnIdentity, appWebhookIdentity), o)
}
// Represents the delivery of a webhook notification, including its
// current status.
type AddOnWebhookDelivery struct{}
type AddOnWebhookDeliveryInfoResult struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
Event struct {
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
} `json:"event" url:"event,key"` // identity of event
ID string `json:"id" url:"id,key"` // the delivery's unique identifier
LastAttempt *struct {
Code *int `json:"code" url:"code,key"` // http response code received during attempt
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
ID string `json:"id" url:"id,key"` // unique identifier of attempt
Status string `json:"status" url:"status,key"` // status of an attempt
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
} `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
Status string `json:"status" url:"status,key"` // the delivery's status
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
Webhook struct {
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
} `json:"webhook" url:"webhook,key"` // identity of webhook
}
// Returns the info for an existing delivery. Can only be accessed by
// the add-on partner providing this add-on.
func (s *Service) AddOnWebhookDeliveryInfo(ctx context.Context, addOnIdentity string, appWebhookDeliveryIdentity string) (*AddOnWebhookDeliveryInfoResult, error) {
var addOnWebhookDelivery AddOnWebhookDeliveryInfoResult
return &addOnWebhookDelivery, s.Get(ctx, &addOnWebhookDelivery, fmt.Sprintf("/addons/%v/webhook-deliveries/%v", addOnIdentity, appWebhookDeliveryIdentity), nil, nil)
}
type AddOnWebhookDeliveryListResult []struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
Event struct {
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
} `json:"event" url:"event,key"` // identity of event
ID string `json:"id" url:"id,key"` // the delivery's unique identifier
LastAttempt *struct {
Code *int `json:"code" url:"code,key"` // http response code received during attempt
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
ID string `json:"id" url:"id,key"` // unique identifier of attempt
Status string `json:"status" url:"status,key"` // status of an attempt
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
} `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
Status string `json:"status" url:"status,key"` // the delivery's status
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
Webhook struct {
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
} `json:"webhook" url:"webhook,key"` // identity of webhook
}
// Lists existing deliveries for an add-on. Can only be accessed by the
// add-on partner providing this add-on.
func (s *Service) AddOnWebhookDeliveryList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookDeliveryListResult, error) {
var addOnWebhookDelivery AddOnWebhookDeliveryListResult
return addOnWebhookDelivery, s.Get(ctx, &addOnWebhookDelivery, fmt.Sprintf("/addons/%v/webhook-deliveries", addOnIdentity), nil, lr)
}
// Represents a webhook event that occurred.
type AddOnWebhookEvent struct{}
type AddOnWebhookEventInfoResult struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
Payload struct {
Action string `json:"action" url:"action,key"` // the type of event that occurred
Actor struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"actor" url:"actor,key"` // user that caused event
Data struct{} `json:"data" url:"data,key"` // the current details of the event
PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
Version string `json:"version" url:"version,key"` // the version of the details provided for the event
} `json:"payload" url:"payload,key"` // payload of event
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
}
// Returns the info for a specified webhook event. Can only be accessed
// by the add-on partner providing this add-on.
func (s *Service) AddOnWebhookEventInfo(ctx context.Context, addOnIdentity string, appWebhookEventIdentity string) (*AddOnWebhookEventInfoResult, error) {
var addOnWebhookEvent AddOnWebhookEventInfoResult
return &addOnWebhookEvent, s.Get(ctx, &addOnWebhookEvent, fmt.Sprintf("/addons/%v/webhook-events/%v", addOnIdentity, appWebhookEventIdentity), nil, nil)
}
type AddOnWebhookEventListResult []struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
Payload struct {
Action string `json:"action" url:"action,key"` // the type of event that occurred
Actor struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"actor" url:"actor,key"` // user that caused event
Data struct{} `json:"data" url:"data,key"` // the current details of the event
PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
Version string `json:"version" url:"version,key"` // the version of the details provided for the event
} `json:"payload" url:"payload,key"` // payload of event
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
}
// Lists existing webhook events for an add-on. Can only be accessed by
// the add-on partner providing this add-on.
func (s *Service) AddOnWebhookEventList(ctx context.Context, addOnIdentity string, lr *ListRange) (AddOnWebhookEventListResult, error) {
var addOnWebhookEvent AddOnWebhookEventListResult
return addOnWebhookEvent, s.Get(ctx, &addOnWebhookEvent, fmt.Sprintf("/addons/%v/webhook-events", addOnIdentity), nil, lr)
}
// Entities that have been allowed to be used by a Team
type AllowedAddOnService struct {
AddedAt time.Time `json:"added_at" url:"added_at,key"` // when the add-on service was allowed
AddedBy struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"added_by" url:"added_by,key"` // the user which allowed the add-on service
AddonService struct {
HumanName string `json:"human_name" url:"human_name,key"` // human-readable name of the add-on service provider
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // the add-on service allowed for use
ID string `json:"id" url:"id,key"` // unique identifier for this allowed add-on service record
}
type AllowedAddOnServiceListByTeamResult []AllowedAddOnService
// List all allowed add-on services for a team
func (s *Service) AllowedAddOnServiceListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (AllowedAddOnServiceListByTeamResult, error) {
var allowedAddOnService AllowedAddOnServiceListByTeamResult
return allowedAddOnService, s.Get(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services", teamIdentity), nil, lr)
}
type AllowedAddOnServiceCreateByTeamOpts struct {
AddonService *string `json:"addon_service,omitempty" url:"addon_service,omitempty,key"` // name of the add-on service to allow
}
type AllowedAddOnServiceCreateByTeamResult []AllowedAddOnService
// Allow an Add-on Service
func (s *Service) AllowedAddOnServiceCreateByTeam(ctx context.Context, teamIdentity string, o AllowedAddOnServiceCreateByTeamOpts) (AllowedAddOnServiceCreateByTeamResult, error) {
var allowedAddOnService AllowedAddOnServiceCreateByTeamResult
return allowedAddOnService, s.Post(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services", teamIdentity), o)
}
// Remove an allowed add-on service
func (s *Service) AllowedAddOnServiceDeleteByTeam(ctx context.Context, teamIdentity string, allowedAddOnServiceIdentity string) (*AllowedAddOnService, error) {
var allowedAddOnService AllowedAddOnService
return &allowedAddOnService, s.Delete(ctx, &allowedAddOnService, fmt.Sprintf("/teams/%v/allowed-addon-services/%v", teamIdentity, allowedAddOnServiceIdentity))
}
// An app represents the program that you would like to deploy and run
// on Heroku.
type App struct {
Acm bool `json:"acm" url:"acm,key"` // ACM status of this app
ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
BuildStack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
ID string `json:"id" url:"id,key"` // unique identifier of app
InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
Name string `json:"name" url:"name,key"` // unique name of app
Organization *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // identity of team
Owner struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"owner" url:"owner,key"` // identity of app owner
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of app region
ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
Space *struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
} `json:"space" url:"space,key"` // identity of space
Stack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of app stack
Team *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // identity of team
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
}
type AppCreateOpts struct {
FeatureFlags []*string `json:"feature_flags,omitempty" url:"feature_flags,omitempty,key"` // unique name of app feature
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique identifier of region
Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
}
// Create a new app.
func (s *Service) AppCreate(ctx context.Context, o AppCreateOpts) (*App, error) {
var app App
return &app, s.Post(ctx, &app, fmt.Sprintf("/apps"), o)
}
// Delete an existing app.
func (s *Service) AppDelete(ctx context.Context, appIdentity string) (*App, error) {
var app App
return &app, s.Delete(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity))
}
// Info for existing app.
func (s *Service) AppInfo(ctx context.Context, appIdentity string) (*App, error) {
var app App
return &app, s.Get(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity), nil, nil)
}
type AppListResult []App
// List existing apps.
func (s *Service) AppList(ctx context.Context, lr *ListRange) (AppListResult, error) {
var app AppListResult
return app, s.Get(ctx, &app, fmt.Sprintf("/apps"), nil, lr)
}
type AppListOwnedAndCollaboratedResult []App
// List owned and collaborated apps (excludes team apps).
func (s *Service) AppListOwnedAndCollaborated(ctx context.Context, accountIdentity string, lr *ListRange) (AppListOwnedAndCollaboratedResult, error) {
var app AppListOwnedAndCollaboratedResult
return app, s.Get(ctx, &app, fmt.Sprintf("/users/%v/apps", accountIdentity), nil, lr)
}
type AppUpdateOpts struct {
BuildStack *string `json:"build_stack,omitempty" url:"build_stack,omitempty,key"` // unique name of stack
Maintenance *bool `json:"maintenance,omitempty" url:"maintenance,omitempty,key"` // maintenance status of app
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
}
// Update an existing app.
func (s *Service) AppUpdate(ctx context.Context, appIdentity string, o AppUpdateOpts) (*App, error) {
var app App
return &app, s.Patch(ctx, &app, fmt.Sprintf("/apps/%v", appIdentity), o)
}
// Enable ACM flag for an app
func (s *Service) AppEnableACM(ctx context.Context, appIdentity string) (*App, error) {
var app App
return &app, s.Post(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity), nil)
}
// Disable ACM flag for an app
func (s *Service) AppDisableACM(ctx context.Context, appIdentity string) (*App, error) {
var app App
return &app, s.Delete(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity))
}
// Refresh ACM for an app
func (s *Service) AppRefreshACM(ctx context.Context, appIdentity string) (*App, error) {
var app App
return &app, s.Patch(ctx, &app, fmt.Sprintf("/apps/%v/acm", appIdentity), nil)
}
// An app feature represents a Heroku labs capability that can be
// enabled or disabled for an app on Heroku.
type AppFeature struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app feature was created
Description string `json:"description" url:"description,key"` // description of app feature
DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of app feature
Enabled bool `json:"enabled" url:"enabled,key"` // whether or not app feature has been enabled
FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
ID string `json:"id" url:"id,key"` // unique identifier of app feature
Name string `json:"name" url:"name,key"` // unique name of app feature
State string `json:"state" url:"state,key"` // state of app feature
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app feature was updated
}
// Info for an existing app feature.
func (s *Service) AppFeatureInfo(ctx context.Context, appIdentity string, appFeatureIdentity string) (*AppFeature, error) {
var appFeature AppFeature
return &appFeature, s.Get(ctx, &appFeature, fmt.Sprintf("/apps/%v/features/%v", appIdentity, appFeatureIdentity), nil, nil)
}
type AppFeatureListResult []AppFeature
// List existing app features.
func (s *Service) AppFeatureList(ctx context.Context, appIdentity string, lr *ListRange) (AppFeatureListResult, error) {
var appFeature AppFeatureListResult
return appFeature, s.Get(ctx, &appFeature, fmt.Sprintf("/apps/%v/features", appIdentity), nil, lr)
}
type AppFeatureUpdateOpts struct {
Enabled bool `json:"enabled" url:"enabled,key"` // whether or not app feature has been enabled
}
// Update an existing app feature.
func (s *Service) AppFeatureUpdate(ctx context.Context, appIdentity string, appFeatureIdentity string, o AppFeatureUpdateOpts) (*AppFeature, error) {
var appFeature AppFeature
return &appFeature, s.Patch(ctx, &appFeature, fmt.Sprintf("/apps/%v/features/%v", appIdentity, appFeatureIdentity), o)
}
// App formation set describes the combination of process types with
// their quantities and sizes as well as application process tier
type AppFormationSet struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app being described by the formation-set
Description string `json:"description" url:"description,key"` // a string representation of the formation set
ProcessTier string `json:"process_tier" url:"process_tier,key"` // application process tier
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // last time fomation-set was updated
}
// An app setup represents an app on Heroku that is setup using an
// environment, addons, and scripts described in an app.json manifest
// file.
type AppSetup struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app
Build *struct {
ID string `json:"id" url:"id,key"` // unique identifier of build
OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
// stream is available as either `text/plain` or `text/event-stream`.
// Clients should be prepared to handle disconnects and can resume the
// stream by sending a `Range` header (for `text/plain`) or a
// `Last-Event-Id` header (for `text/event-stream`).
Status string `json:"status" url:"status,key"` // status of build
} `json:"build" url:"build,key"` // identity and status of build
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app setup was created
FailureMessage *string `json:"failure_message" url:"failure_message,key"` // reason that app setup has failed
ID string `json:"id" url:"id,key"` // unique identifier of app setup
ManifestErrors []string `json:"manifest_errors" url:"manifest_errors,key"` // errors associated with invalid app.json manifest file
Postdeploy *struct {
ExitCode int `json:"exit_code" url:"exit_code,key"` // The exit code of the postdeploy script
Output string `json:"output" url:"output,key"` // output of the postdeploy script
} `json:"postdeploy" url:"postdeploy,key"` // result of postdeploy script
ResolvedSuccessURL *string `json:"resolved_success_url" url:"resolved_success_url,key"` // fully qualified success url
Status string `json:"status" url:"status,key"` // the overall status of app setup
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app setup was updated
}
type AppSetupCreateOpts struct {
App *struct {
Locked *bool `json:"locked,omitempty" url:"locked,omitempty,key"` // are other team members forbidden from joining this app.
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
Organization *string `json:"organization,omitempty" url:"organization,omitempty,key"` // unique name of team
Personal *bool `json:"personal,omitempty" url:"personal,omitempty,key"` // force creation of the app in the user account even if a default team
// is set.
Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique name of region
Space *string `json:"space,omitempty" url:"space,omitempty,key"` // unique name of space
Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
} `json:"app,omitempty" url:"app,omitempty,key"` // optional parameters for created app
Overrides *struct {
Buildpacks []*struct {
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // location of the buildpack
} `json:"buildpacks,omitempty" url:"buildpacks,omitempty,key"` // overrides the buildpacks specified in the app.json manifest file
Env map[string]string `json:"env,omitempty" url:"env,omitempty,key"` // overrides of the env specified in the app.json manifest file
} `json:"overrides,omitempty" url:"overrides,omitempty,key"` // overrides of keys in the app.json manifest file
SourceBlob struct {
Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the gzipped tarball for verifying its
// integrity
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL of gzipped tarball of source code containing app.json manifest
// file
Version *string `json:"version,omitempty" url:"version,omitempty,key"` // Version of the gzipped tarball.
} `json:"source_blob" url:"source_blob,key"` // gzipped tarball of source code containing app.json manifest file
}
// Create a new app setup from a gzipped tar archive containing an
// app.json manifest file.
func (s *Service) AppSetupCreate(ctx context.Context, o AppSetupCreateOpts) (*AppSetup, error) {
var appSetup AppSetup
return &appSetup, s.Post(ctx, &appSetup, fmt.Sprintf("/app-setups"), o)
}
// Get the status of an app setup.
func (s *Service) AppSetupInfo(ctx context.Context, appSetupIdentity string) (*AppSetup, error) {
var appSetup AppSetup
return &appSetup, s.Get(ctx, &appSetup, fmt.Sprintf("/app-setups/%v", appSetupIdentity), nil, nil)
}
// An app transfer represents a two party interaction for transferring
// ownership of an app.
type AppTransfer struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app involved in the transfer
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app transfer was created
ID string `json:"id" url:"id,key"` // unique identifier of app transfer
Owner struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"owner" url:"owner,key"` // identity of the owner of the transfer
Recipient struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"recipient" url:"recipient,key"` // identity of the recipient of the transfer
State string `json:"state" url:"state,key"` // the current state of an app transfer
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app transfer was updated
}
type AppTransferCreateOpts struct {
App string `json:"app" url:"app,key"` // unique identifier of app
Recipient string `json:"recipient" url:"recipient,key"` // unique email address of account
Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email notification when transferring apps
}
// Create a new app transfer.
func (s *Service) AppTransferCreate(ctx context.Context, o AppTransferCreateOpts) (*AppTransfer, error) {
var appTransfer AppTransfer
return &appTransfer, s.Post(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers"), o)
}
// Delete an existing app transfer
func (s *Service) AppTransferDelete(ctx context.Context, appTransferIdentity string) (*AppTransfer, error) {
var appTransfer AppTransfer
return &appTransfer, s.Delete(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity))
}
// Info for existing app transfer.
func (s *Service) AppTransferInfo(ctx context.Context, appTransferIdentity string) (*AppTransfer, error) {
var appTransfer AppTransfer
return &appTransfer, s.Get(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity), nil, nil)
}
type AppTransferListResult []AppTransfer
// List existing apps transfers.
func (s *Service) AppTransferList(ctx context.Context, lr *ListRange) (AppTransferListResult, error) {
var appTransfer AppTransferListResult
return appTransfer, s.Get(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers"), nil, lr)
}
type AppTransferUpdateOpts struct {
State string `json:"state" url:"state,key"` // the current state of an app transfer
}
// Update an existing app transfer.
func (s *Service) AppTransferUpdate(ctx context.Context, appTransferIdentity string, o AppTransferUpdateOpts) (*AppTransfer, error) {
var appTransfer AppTransfer
return &appTransfer, s.Patch(ctx, &appTransfer, fmt.Sprintf("/account/app-transfers/%v", appTransferIdentity), o)
}
// Represents the details of a webhook subscription
type AppWebhook struct{}
type AppWebhookCreateOpts struct {
Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
// webhook notifications
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
// requests (the signature is included in the request’s
// `Heroku-Webhook-Hmac-SHA256` header)
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
type AppWebhookCreateResult struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Create an app webhook subscription.
func (s *Service) AppWebhookCreate(ctx context.Context, appIdentity string, o AppWebhookCreateOpts) (*AppWebhookCreateResult, error) {
var appWebhook AppWebhookCreateResult
return &appWebhook, s.Post(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks", appIdentity), o)
}
type AppWebhookDeleteResult struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Removes an app webhook subscription.
func (s *Service) AppWebhookDelete(ctx context.Context, appIdentity string, appWebhookIdentity string) (*AppWebhookDeleteResult, error) {
var appWebhook AppWebhookDeleteResult
return &appWebhook, s.Delete(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity))
}
type AppWebhookInfoResult struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Returns the info for an app webhook subscription.
func (s *Service) AppWebhookInfo(ctx context.Context, appIdentity string, appWebhookIdentity string) (*AppWebhookInfoResult, error) {
var appWebhook AppWebhookInfoResult
return &appWebhook, s.Get(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity), nil, nil)
}
type AppWebhookListResult []struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// List all webhook subscriptions for a particular app.
func (s *Service) AppWebhookList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookListResult, error) {
var appWebhook AppWebhookListResult
return appWebhook, s.Get(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks", appIdentity), nil, lr)
}
type AppWebhookUpdateOpts struct {
Authorization *string `json:"authorization,omitempty" url:"authorization,omitempty,key"` // a custom `Authorization` header that Heroku will include with all
// webhook notifications
Include []*string `json:"include,omitempty" url:"include,omitempty,key"` // the entities that the subscription provides notifications for
Level *string `json:"level,omitempty" url:"level,omitempty,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // a value that Heroku will use to sign all webhook notification
// requests (the signature is included in the request’s
// `Heroku-Webhook-Hmac-SHA256` header)
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL where the webhook's notification requests are sent
}
type AppWebhookUpdateResult struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // identity of app. Only used for customer webhooks.
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the webhook was created
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Include []string `json:"include" url:"include,key"` // the entities that the subscription provides notifications for
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the webhook was updated
URL string `json:"url" url:"url,key"` // the URL where the webhook's notification requests are sent
}
// Updates the details of an app webhook subscription.
func (s *Service) AppWebhookUpdate(ctx context.Context, appIdentity string, appWebhookIdentity string, o AppWebhookUpdateOpts) (*AppWebhookUpdateResult, error) {
var appWebhook AppWebhookUpdateResult
return &appWebhook, s.Patch(ctx, &appWebhook, fmt.Sprintf("/apps/%v/webhooks/%v", appIdentity, appWebhookIdentity), o)
}
// Represents the delivery of a webhook notification, including its
// current status.
type AppWebhookDelivery struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the delivery was created
Event struct {
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
} `json:"event" url:"event,key"` // identity of event
ID string `json:"id" url:"id,key"` // the delivery's unique identifier
LastAttempt *struct {
Code *int `json:"code" url:"code,key"` // http response code received during attempt
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when attempt was created
ErrorClass *string `json:"error_class" url:"error_class,key"` // error class encountered during attempt
ID string `json:"id" url:"id,key"` // unique identifier of attempt
Status string `json:"status" url:"status,key"` // status of an attempt
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when attempt was updated
} `json:"last_attempt" url:"last_attempt,key"` // last attempt of a delivery
NextAttemptAt *time.Time `json:"next_attempt_at" url:"next_attempt_at,key"` // when delivery will be attempted again
NumAttempts int `json:"num_attempts" url:"num_attempts,key"` // number of times a delivery has been attempted
Status string `json:"status" url:"status,key"` // the delivery's status
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the delivery was last updated
Webhook struct {
ID string `json:"id" url:"id,key"` // the webhook's unique identifier
Level string `json:"level" url:"level,key"` // if `notify`, Heroku makes a single, fire-and-forget delivery attempt.
// If `sync`, Heroku attempts multiple deliveries until the request is
// successful or a limit is reached
} `json:"webhook" url:"webhook,key"` // identity of webhook
}
// Returns the info for an existing delivery.
func (s *Service) AppWebhookDeliveryInfo(ctx context.Context, appIdentity string, appWebhookDeliveryIdentity string) (*AppWebhookDelivery, error) {
var appWebhookDelivery AppWebhookDelivery
return &appWebhookDelivery, s.Get(ctx, &appWebhookDelivery, fmt.Sprintf("/apps/%v/webhook-deliveries/%v", appIdentity, appWebhookDeliveryIdentity), nil, nil)
}
type AppWebhookDeliveryListResult []AppWebhookDelivery
// Lists existing deliveries for an app.
func (s *Service) AppWebhookDeliveryList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookDeliveryListResult, error) {
var appWebhookDelivery AppWebhookDeliveryListResult
return appWebhookDelivery, s.Get(ctx, &appWebhookDelivery, fmt.Sprintf("/apps/%v/webhook-deliveries", appIdentity), nil, lr)
}
// Represents a webhook event that occurred.
type AppWebhookEvent struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
ID string `json:"id" url:"id,key"` // the event's unique identifier
Include string `json:"include" url:"include,key"` // the type of entity that the event is related to
Payload struct {
Action string `json:"action" url:"action,key"` // the type of event that occurred
Actor struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"actor" url:"actor,key"` // user that caused event
Data struct{} `json:"data" url:"data,key"` // the current details of the event
PreviousData struct{} `json:"previous_data" url:"previous_data,key"` // previous details of the event (if any)
Resource string `json:"resource" url:"resource,key"` // the type of resource associated with the event
Version string `json:"version" url:"version,key"` // the version of the details provided for the event
} `json:"payload" url:"payload,key"` // payload of event
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the event was last updated
}
// Returns the info for a specified webhook event.
func (s *Service) AppWebhookEventInfo(ctx context.Context, appIdentity string, appWebhookEventIdentity string) (*AppWebhookEvent, error) {
var appWebhookEvent AppWebhookEvent
return &appWebhookEvent, s.Get(ctx, &appWebhookEvent, fmt.Sprintf("/apps/%v/webhook-events/%v", appIdentity, appWebhookEventIdentity), nil, nil)
}
type AppWebhookEventListResult []AppWebhookEvent
// Lists existing webhook events for an app.
func (s *Service) AppWebhookEventList(ctx context.Context, appIdentity string, lr *ListRange) (AppWebhookEventListResult, error) {
var appWebhookEvent AppWebhookEventListResult
return appWebhookEvent, s.Get(ctx, &appWebhookEvent, fmt.Sprintf("/apps/%v/webhook-events", appIdentity), nil, lr)
}
// An audit trail archive represents a monthly json zipped file
// containing events
type Archive struct {
Checksum string `json:"checksum" url:"checksum,key"` // checksum for the archive
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when archive was created
Month string `json:"month" url:"month,key"` // month of the archive
Size int `json:"size" url:"size,key"` // size of the archive in bytes
URL string `json:"url" url:"url,key"` // url where to download the archive
Year int `json:"year" url:"year,key"` // year of the archive
}
// Get archive for a single month.
func (s *Service) ArchiveInfo(ctx context.Context, enterpriseAccountIdentity string, archiveYear int, archiveMonth string) (*Archive, error) {
var archive Archive
return &archive, s.Get(ctx, &archive, fmt.Sprintf("/enterprise-accounts/%v/archives/%v/%v", enterpriseAccountIdentity, archiveYear, archiveMonth), nil, nil)
}
// List existing archives.
func (s *Service) ArchiveList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (*Archive, error) {
var archive Archive
return &archive, s.Get(ctx, &archive, fmt.Sprintf("/enterprise-accounts/%v/archives", enterpriseAccountIdentity), nil, lr)
}
// An audit trail event represents some action on the platform
type AuditTrailEvent struct {
Action string `json:"action" url:"action,key"` // action for the event
Actor struct {
Email string `json:"email" url:"email,key"`
ID string `json:"id" url:"id,key"`
} `json:"actor" url:"actor,key"` // user who caused event
App struct {
ID string `json:"id" url:"id,key"`
Name string `json:"name" url:"name,key"`
} `json:"app" url:"app,key"` // app upon which event took place
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when event was created
Data struct{} `json:"data" url:"data,key"` // data specific to the event
EnterpriseAccount struct {
ID string `json:"id" url:"id,key"`
Name string `json:"name" url:"name,key"`
} `json:"enterprise_account" url:"enterprise_account,key"` // enterprise account on which the event happened
ID string `json:"id" url:"id,key"` // unique identifier of event
Owner struct {
Email string `json:"email" url:"email,key"`
ID string `json:"id" url:"id,key"`
} `json:"owner" url:"owner,key"` // owner of the app targeted by the event
Request struct {
IPAddress string `json:"ip_address" url:"ip_address,key"`
} `json:"request" url:"request,key"` // information about where the action was triggered
Team struct {
ID string `json:"id" url:"id,key"`
Name string `json:"name" url:"name,key"`
} `json:"team" url:"team,key"` // team on which the event happened
Type string `json:"type" url:"type,key"` // type of event
}
// List existing events. Returns all events for one day, defaulting to
// current day. Order, actor, action, and type, and day query params can
// be specified as query parameters. For example,
// '/enterprise-accounts/:id/events?order=desc&actor=user@example.com&act
// ion=create&type=app&day=2020-09-30' would return events in descending
// order and only return app created events by the user with
// user@example.com email address.
func (s *Service) AuditTrailEventList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (*AuditTrailEvent, error) {
var auditTrailEvent AuditTrailEvent
return &auditTrailEvent, s.Get(ctx, &auditTrailEvent, fmt.Sprintf("/enterprise-accounts/%v/events", enterpriseAccountIdentity), nil, lr)
}
// A build represents the process of transforming a code tarball into a
// slug
type Build struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // app that the build belongs to
Buildpacks []struct {
Name string `json:"name" url:"name,key"` // Buildpack Registry name of the buildpack for the app
URL string `json:"url" url:"url,key"` // the URL of the buildpack for the app
} `json:"buildpacks" url:"buildpacks,key"` // buildpacks executed for this build, in order
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when build was created
ID string `json:"id" url:"id,key"` // unique identifier of build
OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
// stream is available as either `text/plain` or `text/event-stream`.
// Clients should be prepared to handle disconnects and can resume the
// stream by sending a `Range` header (for `text/plain`) or a
// `Last-Event-Id` header (for `text/event-stream`).
Release *struct {
ID string `json:"id" url:"id,key"` // unique identifier of release
} `json:"release" url:"release,key"` // release resulting from the build
Slug *struct {
ID string `json:"id" url:"id,key"` // unique identifier of slug
} `json:"slug" url:"slug,key"` // slug created by this build
SourceBlob struct {
Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the gzipped tarball for verifying its
// integrity
URL string `json:"url" url:"url,key"` // URL where gzipped tar archive of source code for build was
// downloaded.
Version *string `json:"version" url:"version,key"` // Version of the gzipped tarball.
} `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
Stack string `json:"stack" url:"stack,key"` // stack of build
Status string `json:"status" url:"status,key"` // status of build
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when build was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user that started the build
}
type BuildCreateOpts struct {
Buildpacks []*struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // Buildpack Registry name of the buildpack for the app
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // the URL of the buildpack for the app
} `json:"buildpacks,omitempty" url:"buildpacks,omitempty,key"` // buildpacks executed for this build, in order
SourceBlob struct {
Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the gzipped tarball for verifying its
// integrity
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL where gzipped tar archive of source code for build was
// downloaded.
Version *string `json:"version,omitempty" url:"version,omitempty,key"` // Version of the gzipped tarball.
} `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
}
// Create a new build.
func (s *Service) BuildCreate(ctx context.Context, appIdentity string, o BuildCreateOpts) (*Build, error) {
var build Build
return &build, s.Post(ctx, &build, fmt.Sprintf("/apps/%v/builds", appIdentity), o)
}
// Info for existing build.
func (s *Service) BuildInfo(ctx context.Context, appIdentity string, buildIdentity string) (*Build, error) {
var build Build
return &build, s.Get(ctx, &build, fmt.Sprintf("/apps/%v/builds/%v", appIdentity, buildIdentity), nil, nil)
}
type BuildListResult []Build
// List existing build.
func (s *Service) BuildList(ctx context.Context, appIdentity string, lr *ListRange) (BuildListResult, error) {
var build BuildListResult
return build, s.Get(ctx, &build, fmt.Sprintf("/apps/%v/builds", appIdentity), nil, lr)
}
// Destroy a build cache.
func (s *Service) BuildDeleteCache(ctx context.Context, appIdentity string) (*Build, error) {
var build Build
return &build, s.Delete(ctx, &build, fmt.Sprintf("/apps/%v/build-cache", appIdentity))
}
// A buildpack installation represents a buildpack that will be run
// against an app.
type BuildpackInstallation struct {
Buildpack struct {
Name string `json:"name" url:"name,key"` // either the Buildpack Registry name or a URL of the buildpack for the
// app
URL string `json:"url" url:"url,key"` // location of the buildpack for the app. Either a url (unofficial
// buildpacks) or an internal urn (heroku official buildpacks).
} `json:"buildpack" url:"buildpack,key"` // buildpack
Ordinal int `json:"ordinal" url:"ordinal,key"` // determines the order in which the buildpacks will execute
}
type BuildpackInstallationUpdateOpts struct {
Updates []struct {
Buildpack string `json:"buildpack" url:"buildpack,key"` // location of the buildpack for the app. Either a url (unofficial
// buildpacks) or an internal urn (heroku official buildpacks).
} `json:"updates" url:"updates,key"` // The buildpack attribute can accept a name, a url, or a urn.
}
type BuildpackInstallationUpdateResult []BuildpackInstallation
// Update an app's buildpack installations.
func (s *Service) BuildpackInstallationUpdate(ctx context.Context, appIdentity string, o BuildpackInstallationUpdateOpts) (BuildpackInstallationUpdateResult, error) {
var buildpackInstallation BuildpackInstallationUpdateResult
return buildpackInstallation, s.Put(ctx, &buildpackInstallation, fmt.Sprintf("/apps/%v/buildpack-installations", appIdentity), o)
}
type BuildpackInstallationListResult []BuildpackInstallation
// List an app's existing buildpack installations.
func (s *Service) BuildpackInstallationList(ctx context.Context, appIdentity string, lr *ListRange) (BuildpackInstallationListResult, error) {
var buildpackInstallation BuildpackInstallationListResult
return buildpackInstallation, s.Get(ctx, &buildpackInstallation, fmt.Sprintf("/apps/%v/buildpack-installations", appIdentity), nil, lr)
}
// A collaborator represents an account that has been given access to an
// app on Heroku.
type Collaborator struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app collaborator belongs to
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when collaborator was created
ID string `json:"id" url:"id,key"` // unique identifier of collaborator
Permissions []struct {
Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
Name string `json:"name" url:"name,key"` // The name of the app permission.
} `json:"permissions" url:"permissions,key"`
Role *string `json:"role" url:"role,key"` // role in the team
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when collaborator was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // identity of collaborated account
}
type CollaboratorCreateOpts struct {
Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email invitation when creating collaborator
User string `json:"user" url:"user,key"` // unique email address of account
}
// Create a new collaborator.
func (s *Service) CollaboratorCreate(ctx context.Context, appIdentity string, o CollaboratorCreateOpts) (*Collaborator, error) {
var collaborator Collaborator
return &collaborator, s.Post(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators", appIdentity), o)
}
// Delete an existing collaborator.
func (s *Service) CollaboratorDelete(ctx context.Context, appIdentity string, collaboratorIdentity string) (*Collaborator, error) {
var collaborator Collaborator
return &collaborator, s.Delete(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators/%v", appIdentity, collaboratorIdentity))
}
// Info for existing collaborator.
func (s *Service) CollaboratorInfo(ctx context.Context, appIdentity string, collaboratorIdentity string) (*Collaborator, error) {
var collaborator Collaborator
return &collaborator, s.Get(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators/%v", appIdentity, collaboratorIdentity), nil, nil)
}
type CollaboratorListResult []Collaborator
// List existing collaborators.
func (s *Service) CollaboratorList(ctx context.Context, appIdentity string, lr *ListRange) (CollaboratorListResult, error) {
var collaborator CollaboratorListResult
return collaborator, s.Get(ctx, &collaborator, fmt.Sprintf("/apps/%v/collaborators", appIdentity), nil, lr)
}
// Config Vars allow you to manage the configuration information
// provided to an app on Heroku.
type ConfigVar map[string]string
type ConfigVarInfoForAppResult map[string]*string
// Get config-vars for app.
func (s *Service) ConfigVarInfoForApp(ctx context.Context, appIdentity string) (ConfigVarInfoForAppResult, error) {
var configVar ConfigVarInfoForAppResult
return configVar, s.Get(ctx, &configVar, fmt.Sprintf("/apps/%v/config-vars", appIdentity), nil, nil)
}
type ConfigVarInfoForAppReleaseResult map[string]*string
// Get config-vars for a release.
func (s *Service) ConfigVarInfoForAppRelease(ctx context.Context, appIdentity string, releaseIdentity string) (ConfigVarInfoForAppReleaseResult, error) {
var configVar ConfigVarInfoForAppReleaseResult
return configVar, s.Get(ctx, &configVar, fmt.Sprintf("/apps/%v/releases/%v/config-vars", appIdentity, releaseIdentity), nil, nil)
}
type ConfigVarUpdateResult map[string]*string
// Update config-vars for app. You can update existing config-vars by
// setting them again, and remove by setting it to `null`.
func (s *Service) ConfigVarUpdate(ctx context.Context, appIdentity string, o map[string]*string) (ConfigVarUpdateResult, error) {
var configVar ConfigVarUpdateResult
return configVar, s.Patch(ctx, &configVar, fmt.Sprintf("/apps/%v/config-vars", appIdentity), o)
}
// A credit represents value that will be used up before further charges
// are assigned to an account.
type Credit struct {
Amount float64 `json:"amount" url:"amount,key"` // total value of credit in cents
Balance float64 `json:"balance" url:"balance,key"` // remaining value of credit in cents
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when credit was created
ExpiresAt time.Time `json:"expires_at" url:"expires_at,key"` // when credit will expire
ID string `json:"id" url:"id,key"` // unique identifier of credit
Title string `json:"title" url:"title,key"` // a name for credit
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when credit was updated
}
type CreditCreateOpts struct {
Code1 *string `json:"code1,omitempty" url:"code1,omitempty,key"` // first code from a discount card
Code2 *string `json:"code2,omitempty" url:"code2,omitempty,key"` // second code from a discount card
}
// Create a new credit.
func (s *Service) CreditCreate(ctx context.Context, o CreditCreateOpts) (*Credit, error) {
var credit Credit
return &credit, s.Post(ctx, &credit, fmt.Sprintf("/account/credits"), o)
}
// Info for existing credit.
func (s *Service) CreditInfo(ctx context.Context, creditIdentity string) (*Credit, error) {
var credit Credit
return &credit, s.Get(ctx, &credit, fmt.Sprintf("/account/credits/%v", creditIdentity), nil, nil)
}
type CreditListResult []Credit
// List existing credits.
func (s *Service) CreditList(ctx context.Context, lr *ListRange) (CreditListResult, error) {
var credit CreditListResult
return credit, s.Get(ctx, &credit, fmt.Sprintf("/account/credits"), nil, lr)
}
// Domains define what web routes should be routed to an app on Heroku.
type Domain struct {
AcmStatus *string `json:"acm_status" url:"acm_status,key"` // status of this record's ACM
AcmStatusReason *string `json:"acm_status_reason" url:"acm_status_reason,key"` // reason for the status of this record's ACM
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app that owns the domain
CName *string `json:"cname" url:"cname,key"` // canonical name record, the address to point a domain at
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when domain was created
Hostname string `json:"hostname" url:"hostname,key"` // full hostname
ID string `json:"id" url:"id,key"` // unique identifier of this domain
Kind string `json:"kind" url:"kind,key"` // type of domain name
SniEndpoint *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this SNI endpoint
Name string `json:"name" url:"name,key"` // unique name for SNI endpoint
} `json:"sni_endpoint" url:"sni_endpoint,key"` // sni endpoint the domain is associated with
Status string `json:"status" url:"status,key"` // status of this record's cname
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when domain was updated
}
type DomainCreateOpts struct {
Hostname string `json:"hostname" url:"hostname,key"` // full hostname
SniEndpoint *string `json:"sni_endpoint" url:"sni_endpoint,key"` // null or unique identifier or name for SNI endpoint
}
// Create a new domain.
func (s *Service) DomainCreate(ctx context.Context, appIdentity string, o DomainCreateOpts) (*Domain, error) {
var domain Domain
return &domain, s.Post(ctx, &domain, fmt.Sprintf("/apps/%v/domains", appIdentity), o)
}
type DomainUpdateOpts struct {
SniEndpoint *string `json:"sni_endpoint" url:"sni_endpoint,key"` // null or unique identifier or name for SNI endpoint
}
// Associate an SNI endpoint
func (s *Service) DomainUpdate(ctx context.Context, appIdentity string, domainIdentity string, o DomainUpdateOpts) (*Domain, error) {
var domain Domain
return &domain, s.Patch(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity), o)
}
// Delete an existing domain
func (s *Service) DomainDelete(ctx context.Context, appIdentity string, domainIdentity string) (*Domain, error) {
var domain Domain
return &domain, s.Delete(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity))
}
// Info for existing domain.
func (s *Service) DomainInfo(ctx context.Context, appIdentity string, domainIdentity string) (*Domain, error) {
var domain Domain
return &domain, s.Get(ctx, &domain, fmt.Sprintf("/apps/%v/domains/%v", appIdentity, domainIdentity), nil, nil)
}
type DomainListResult []Domain
// List existing domains.
func (s *Service) DomainList(ctx context.Context, appIdentity string, lr *ListRange) (DomainListResult, error) {
var domain DomainListResult
return domain, s.Get(ctx, &domain, fmt.Sprintf("/apps/%v/domains", appIdentity), nil, lr)
}
// Dynos encapsulate running processes of an app on Heroku. Detailed
// information about dyno sizes can be found at:
// [https://devcenter.heroku.com/articles/dyno-types](https://devcenter.h
// eroku.com/articles/dyno-types).
type Dyno struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app formation belongs to
AttachURL *string `json:"attach_url" url:"attach_url,key"` // a URL to stream output from for attached processes or null for
// non-attached processes
Command string `json:"command" url:"command,key"` // command used to start this process
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when dyno was created
ID string `json:"id" url:"id,key"` // unique identifier of this dyno
Name string `json:"name" url:"name,key"` // the name of this process on this dyno
Release struct {
ID string `json:"id" url:"id,key"` // unique identifier of release
Version int `json:"version" url:"version,key"` // unique version assigned to the release
} `json:"release" url:"release,key"` // app release of the dyno
Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
State string `json:"state" url:"state,key"` // current status of process (either: crashed, down, idle, starting, or
// up)
Type string `json:"type" url:"type,key"` // type of process
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when process last changed state
}
type DynoCreateOpts struct {
Attach *bool `json:"attach,omitempty" url:"attach,omitempty,key"` // whether to stream output or not
Command string `json:"command" url:"command,key"` // command used to start this process
Env map[string]string `json:"env,omitempty" url:"env,omitempty,key"` // custom environment to add to the dyno config vars
ForceNoTty *bool `json:"force_no_tty,omitempty" url:"force_no_tty,omitempty,key"` // force an attached one-off dyno to not run in a tty
Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
TimeToLive *int `json:"time_to_live,omitempty" url:"time_to_live,omitempty,key"` // seconds until dyno expires, after which it will soon be killed, max
// 86400 seconds (24 hours)
Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of process
}
// Create a new dyno.
func (s *Service) DynoCreate(ctx context.Context, appIdentity string, o DynoCreateOpts) (*Dyno, error) {
var dyno Dyno
return &dyno, s.Post(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity), o)
}
type DynoRestartResult struct{}
// Restart dyno.
func (s *Service) DynoRestart(ctx context.Context, appIdentity string, dynoIdentity string) (DynoRestartResult, error) {
var dyno DynoRestartResult
return dyno, s.Delete(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v", appIdentity, dynoIdentity))
}
type DynoRestartAllResult struct{}
// Restart all dynos.
func (s *Service) DynoRestartAll(ctx context.Context, appIdentity string) (DynoRestartAllResult, error) {
var dyno DynoRestartAllResult
return dyno, s.Delete(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity))
}
type DynoStopResult struct{}
// Stop dyno.
func (s *Service) DynoStop(ctx context.Context, appIdentity string, dynoIdentity string) (DynoStopResult, error) {
var dyno DynoStopResult
return dyno, s.Post(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v/actions/stop", appIdentity, dynoIdentity), nil)
}
// Info for existing dyno.
func (s *Service) DynoInfo(ctx context.Context, appIdentity string, dynoIdentity string) (*Dyno, error) {
var dyno Dyno
return &dyno, s.Get(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v", appIdentity, dynoIdentity), nil, nil)
}
type DynoListResult []Dyno
// List existing dynos.
func (s *Service) DynoList(ctx context.Context, appIdentity string, lr *ListRange) (DynoListResult, error) {
var dyno DynoListResult
return dyno, s.Get(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos", appIdentity), nil, lr)
}
// Dyno sizes are the values and details of sizes that can be assigned
// to dynos. This information can also be found at :
// [https://devcenter.heroku.com/articles/dyno-types](https://devcenter.h
// eroku.com/articles/dyno-types).
type DynoSize struct {
Compute int `json:"compute" url:"compute,key"` // minimum vCPUs, non-dedicated may get more depending on load
Cost *struct{} `json:"cost" url:"cost,key"` // price information for this dyno size
Dedicated bool `json:"dedicated" url:"dedicated,key"` // whether this dyno will be dedicated to one user
DynoUnits int `json:"dyno_units" url:"dyno_units,key"` // unit of consumption for Heroku Enterprise customers
ID string `json:"id" url:"id,key"` // unique identifier of this dyno size
Memory float64 `json:"memory" url:"memory,key"` // amount of RAM in GB
Name string `json:"name" url:"name,key"` // the name of this dyno-size
PrivateSpaceOnly bool `json:"private_space_only" url:"private_space_only,key"` // whether this dyno can only be provisioned in a private space
}
// Info for existing dyno size.
func (s *Service) DynoSizeInfo(ctx context.Context, dynoSizeIdentity string) (*DynoSize, error) {
var dynoSize DynoSize
return &dynoSize, s.Get(ctx, &dynoSize, fmt.Sprintf("/dyno-sizes/%v", dynoSizeIdentity), nil, nil)
}
type DynoSizeListResult []DynoSize
// List existing dyno sizes.
func (s *Service) DynoSizeList(ctx context.Context, lr *ListRange) (DynoSizeListResult, error) {
var dynoSize DynoSizeListResult
return dynoSize, s.Get(ctx, &dynoSize, fmt.Sprintf("/dyno-sizes"), nil, lr)
}
// Enterprise accounts allow companies to manage their development teams
// and billing.
type EnterpriseAccount struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the enterprise account was created
ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider associated with the Enterprise Account
Name string `json:"name" url:"name,key"` // unique name of the enterprise account
Permissions []string `json:"permissions" url:"permissions,key"` // the current user's permissions for this enterprise account
Trial bool `json:"trial" url:"trial,key"` // whether the enterprise account is a trial or not
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the enterprise account was updated
}
type EnterpriseAccountListResult []EnterpriseAccount
// List enterprise accounts in which you are a member.
func (s *Service) EnterpriseAccountList(ctx context.Context, lr *ListRange) (EnterpriseAccountListResult, error) {
var enterpriseAccount EnterpriseAccountListResult
return enterpriseAccount, s.Get(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts"), nil, lr)
}
// Information about an enterprise account.
func (s *Service) EnterpriseAccountInfo(ctx context.Context, enterpriseAccountIdentity string) (*EnterpriseAccount, error) {
var enterpriseAccount EnterpriseAccount
return &enterpriseAccount, s.Get(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts/%v", enterpriseAccountIdentity), nil, nil)
}
type EnterpriseAccountUpdateOpts struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of the enterprise account
}
// Update enterprise account properties
func (s *Service) EnterpriseAccountUpdate(ctx context.Context, enterpriseAccountIdentity string, o EnterpriseAccountUpdateOpts) (*EnterpriseAccount, error) {
var enterpriseAccount EnterpriseAccount
return &enterpriseAccount, s.Patch(ctx, &enterpriseAccount, fmt.Sprintf("/enterprise-accounts/%v", enterpriseAccountIdentity), o)
}
// Usage for an enterprise account at a daily resolution.
type EnterpriseAccountDailyUsage struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Date string `json:"date" url:"date,key"` // date of the usage
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // enterprise account identifier
Name string `json:"name" url:"name,key"` // name of the enterprise account
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
Teams []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Apps []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
AppName string `json:"app_name" url:"app_name,key"` // unique name of app
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
} `json:"apps" url:"apps,key"` // app usage in the team
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // team identifier
Name string `json:"name" url:"name,key"` // name of the team
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
} `json:"teams" url:"teams,key"` // usage by team
}
type EnterpriseAccountDailyUsageInfoOpts struct {
End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
Start string `json:"start" url:"start,key"` // range start date
}
type EnterpriseAccountDailyUsageInfoResult []EnterpriseAccountDailyUsage
// Retrieves usage for an enterprise account for a range of days. Start
// and end dates can be specified as query parameters using the date
// format YYYY-MM-DD. The enterprise account identifier can be found
// from the [enterprise account
// list](https://devcenter.heroku.com/articles/platform-api-reference#ent
// erprise-account-list).
//
func (s *Service) EnterpriseAccountDailyUsageInfo(ctx context.Context, enterpriseAccountID string, o EnterpriseAccountDailyUsageInfoOpts, lr *ListRange) (EnterpriseAccountDailyUsageInfoResult, error) {
var enterpriseAccountDailyUsage EnterpriseAccountDailyUsageInfoResult
return enterpriseAccountDailyUsage, s.Get(ctx, &enterpriseAccountDailyUsage, fmt.Sprintf("/enterprise-accounts/%v/usage/daily", enterpriseAccountID), o, lr)
}
// Enterprise account members are users with access to an enterprise
// account.
type EnterpriseAccountMember struct {
EnterpriseAccount struct {
ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
Name string `json:"name" url:"name,key"` // unique name of the enterprise account
} `json:"enterprise_account" url:"enterprise_account,key"`
ID string `json:"id" url:"id,key"` // unique identifier of the member
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // name of the identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
Permissions []struct {
Description string `json:"description" url:"description,key"`
Name string `json:"name" url:"name,key"` // permission in the enterprise account
} `json:"permissions" url:"permissions,key"` // enterprise account permissions
TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise Account member has two factor authentication
// enabled
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user information for the membership
}
type EnterpriseAccountMemberListResult []EnterpriseAccountMember
// List members in an enterprise account.
func (s *Service) EnterpriseAccountMemberList(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (EnterpriseAccountMemberListResult, error) {
var enterpriseAccountMember EnterpriseAccountMemberListResult
return enterpriseAccountMember, s.Get(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members", enterpriseAccountIdentity), nil, lr)
}
type EnterpriseAccountMemberCreateOpts struct {
Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether membership is being created as part of SSO JIT
Permissions []string `json:"permissions" url:"permissions,key"` // permissions for enterprise account
User string `json:"user" url:"user,key"` // unique email address of account
}
// Create a member in an enterprise account.
func (s *Service) EnterpriseAccountMemberCreate(ctx context.Context, enterpriseAccountIdentity string, o EnterpriseAccountMemberCreateOpts) (*EnterpriseAccountMember, error) {
var enterpriseAccountMember EnterpriseAccountMember
return &enterpriseAccountMember, s.Post(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members", enterpriseAccountIdentity), o)
}
type EnterpriseAccountMemberUpdateOpts struct {
Permissions []string `json:"permissions" url:"permissions,key"` // permissions for enterprise account
}
// Update a member in an enterprise account.
func (s *Service) EnterpriseAccountMemberUpdate(ctx context.Context, enterpriseAccountIdentity string, enterpriseAccountMemberUserIdentity string, o EnterpriseAccountMemberUpdateOpts) (*EnterpriseAccountMember, error) {
var enterpriseAccountMember EnterpriseAccountMember
return &enterpriseAccountMember, s.Patch(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members/%v", enterpriseAccountIdentity, enterpriseAccountMemberUserIdentity), o)
}
// delete a member in an enterprise account.
func (s *Service) EnterpriseAccountMemberDelete(ctx context.Context, enterpriseAccountIdentity string, enterpriseAccountMemberUserIdentity string) (*EnterpriseAccountMember, error) {
var enterpriseAccountMember EnterpriseAccountMember
return &enterpriseAccountMember, s.Delete(ctx, &enterpriseAccountMember, fmt.Sprintf("/enterprise-accounts/%v/members/%v", enterpriseAccountIdentity, enterpriseAccountMemberUserIdentity))
}
// Usage for an enterprise account at a monthly resolution.
type EnterpriseAccountMonthlyUsage struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // enterprise account identifier
Month string `json:"month" url:"month,key"` // year and month of the usage
Name string `json:"name" url:"name,key"` // name of the enterprise account
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
Teams []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Apps []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
AppName string `json:"app_name" url:"app_name,key"` // unique name of app
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
} `json:"apps" url:"apps,key"` // app usage in the team
Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // team identifier
Name string `json:"name" url:"name,key"` // name of the team
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
} `json:"teams" url:"teams,key"` // usage by team
}
type EnterpriseAccountMonthlyUsageInfoOpts struct {
End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
Start string `json:"start" url:"start,key"` // range start date
}
type EnterpriseAccountMonthlyUsageInfoResult []EnterpriseAccountMonthlyUsage
// Retrieves usage for an enterprise account for a range of months.
// Start and end dates can be specified as query parameters using the
// date format YYYY-MM. If no end date is specified, one month of usage
// is returned. The enterprise account identifier can be found from the
// [enterprise account
// list](https://devcenter.heroku.com/articles/platform-api-reference#ent
// erprise-account-list).
//
func (s *Service) EnterpriseAccountMonthlyUsageInfo(ctx context.Context, enterpriseAccountID string, o EnterpriseAccountMonthlyUsageInfoOpts, lr *ListRange) (EnterpriseAccountMonthlyUsageInfoResult, error) {
var enterpriseAccountMonthlyUsage EnterpriseAccountMonthlyUsageInfoResult
return enterpriseAccountMonthlyUsage, s.Get(ctx, &enterpriseAccountMonthlyUsage, fmt.Sprintf("/enterprise-accounts/%v/usage/monthly", enterpriseAccountID), o, lr)
}
// Filters are special endpoints to allow for API consumers to specify a
// subset of resources to consume in order to reduce the number of
// requests that are performed. Each filter endpoint endpoint is
// responsible for determining its supported request format. The
// endpoints are over POST in order to handle large request bodies
// without hitting request uri query length limitations, but the
// requests themselves are idempotent and will not have side effects.
type FilterApps struct{}
type FilterAppsAppsOpts struct {
In *struct {
ID []*string `json:"id,omitempty" url:"id,omitempty,key"`
} `json:"in,omitempty" url:"in,omitempty,key"`
}
type FilterAppsAppsResult []struct {
ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
BuildStack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
ID string `json:"id" url:"id,key"` // unique identifier of app
InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
Name string `json:"name" url:"name,key"` // unique name of app
Owner *struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"owner" url:"owner,key"` // identity of app owner
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of app region
ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
Space *struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
} `json:"space" url:"space,key"` // identity of space
Stack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of app stack
Team *struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
}
// Request an apps list filtered by app id.
func (s *Service) FilterAppsApps(ctx context.Context, o FilterAppsAppsOpts) (FilterAppsAppsResult, error) {
var filterApps FilterAppsAppsResult
return filterApps, s.Post(ctx, &filterApps, fmt.Sprintf("/filters/apps"), o)
}
// The formation of processes that should be maintained for an app.
// Update the formation to scale processes or change dyno sizes.
// Available process type names and commands are defined by the
// `process_types` attribute for the [slug](#slug) currently released on
// an app.
type Formation struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app formation belongs to
Command string `json:"command" url:"command,key"` // command to use to launch this process
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when process type was created
ID string `json:"id" url:"id,key"` // unique identifier of this process type
Quantity int `json:"quantity" url:"quantity,key"` // number of processes to maintain
Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
Type string `json:"type" url:"type,key"` // type of process to maintain
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when dyno type was updated
}
// Info for a process type
func (s *Service) FormationInfo(ctx context.Context, appIdentity string, formationIdentity string) (*Formation, error) {
var formation Formation
return &formation, s.Get(ctx, &formation, fmt.Sprintf("/apps/%v/formation/%v", appIdentity, formationIdentity), nil, nil)
}
type FormationListResult []Formation
// List process type formation
func (s *Service) FormationList(ctx context.Context, appIdentity string, lr *ListRange) (FormationListResult, error) {
var formation FormationListResult
return formation, s.Get(ctx, &formation, fmt.Sprintf("/apps/%v/formation", appIdentity), nil, lr)
}
type FormationBatchUpdateOpts struct {
Updates []struct {
Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty,key"` // number of processes to maintain
Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
Type string `json:"type" url:"type,key"` // type of process to maintain
} `json:"updates" url:"updates,key"` // Array with formation updates. Each element must have "type", the id
// or name of the process type to be updated, and can optionally update
// its "quantity" or "size".
}
type FormationBatchUpdateResult []Formation
// Batch update process types
func (s *Service) FormationBatchUpdate(ctx context.Context, appIdentity string, o FormationBatchUpdateOpts) (FormationBatchUpdateResult, error) {
var formation FormationBatchUpdateResult
return formation, s.Patch(ctx, &formation, fmt.Sprintf("/apps/%v/formation", appIdentity), o)
}
type FormationUpdateOpts struct {
Quantity *int `json:"quantity,omitempty" url:"quantity,omitempty,key"` // number of processes to maintain
Size *string `json:"size,omitempty" url:"size,omitempty,key"` // dyno size (default: "standard-1X")
}
// Update process type
func (s *Service) FormationUpdate(ctx context.Context, appIdentity string, formationIdentity string, o FormationUpdateOpts) (*Formation, error) {
var formation Formation
return &formation, s.Patch(ctx, &formation, fmt.Sprintf("/apps/%v/formation/%v", appIdentity, formationIdentity), o)
}
// Identity Providers represent the SAML configuration of an Enterprise
// Account or Team.
type IdentityProvider struct {
Certificate string `json:"certificate" url:"certificate,key"` // raw contents of the public certificate (eg: .crt or .pem file)
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when provider record was created
EntityID string `json:"entity_id" url:"entity_id,key"` // URL identifier provided by the identity provider
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Organization *struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // team associated with this identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
SloTargetURL string `json:"slo_target_url" url:"slo_target_url,key"` // single log out URL for this identity provider
SsoTargetURL string `json:"sso_target_url" url:"sso_target_url,key"` // single sign on URL for this identity provider
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the identity provider record was updated
}
type IdentityProviderListByTeamResult []IdentityProvider
// Get a list of a team's Identity Providers
func (s *Service) IdentityProviderListByTeam(ctx context.Context, teamName string, lr *ListRange) (IdentityProviderListByTeamResult, error) {
var identityProvider IdentityProviderListByTeamResult
return identityProvider, s.Get(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers", teamName), nil, lr)
}
type IdentityProviderCreateByTeamOpts struct {
Certificate string `json:"certificate" url:"certificate,key"` // raw contents of the public certificate (eg: .crt or .pem file)
EntityID string `json:"entity_id" url:"entity_id,key"` // URL identifier provided by the identity provider
SloTargetURL *string `json:"slo_target_url,omitempty" url:"slo_target_url,omitempty,key"` // single log out URL for this identity provider
SsoTargetURL string `json:"sso_target_url" url:"sso_target_url,key"` // single sign on URL for this identity provider
}
// Create an Identity Provider for a team
func (s *Service) IdentityProviderCreateByTeam(ctx context.Context, teamName string, o IdentityProviderCreateByTeamOpts) (*IdentityProvider, error) {
var identityProvider IdentityProvider
return &identityProvider, s.Post(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers", teamName), o)
}
type IdentityProviderUpdateByTeamOpts struct {
Certificate *string `json:"certificate,omitempty" url:"certificate,omitempty,key"` // raw contents of the public certificate (eg: .crt or .pem file)
EntityID *string `json:"entity_id,omitempty" url:"entity_id,omitempty,key"` // URL identifier provided by the identity provider
SloTargetURL *string `json:"slo_target_url,omitempty" url:"slo_target_url,omitempty,key"` // single log out URL for this identity provider
SsoTargetURL *string `json:"sso_target_url,omitempty" url:"sso_target_url,omitempty,key"` // single sign on URL for this identity provider
}
// Update a team's Identity Provider
func (s *Service) IdentityProviderUpdateByTeam(ctx context.Context, teamName string, identityProviderID string, o IdentityProviderUpdateByTeamOpts) (*IdentityProvider, error) {
var identityProvider IdentityProvider
return &identityProvider, s.Patch(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers/%v", teamName, identityProviderID), o)
}
// Delete a team's Identity Provider
func (s *Service) IdentityProviderDeleteByTeam(ctx context.Context, teamName string, identityProviderID string) (*IdentityProvider, error) {
var identityProvider IdentityProvider
return &identityProvider, s.Delete(ctx, &identityProvider, fmt.Sprintf("/teams/%v/identity-providers/%v", teamName, identityProviderID))
}
// An inbound-ruleset is a collection of rules that specify what hosts
// can or cannot connect to an application.
type InboundRuleset struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when inbound-ruleset was created
CreatedBy string `json:"created_by" url:"created_by,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an inbound-ruleset
Rules []struct {
Action string `json:"action" url:"action,key"` // states whether the connection is allowed or denied
Source string `json:"source" url:"source,key"` // is the request’s source in CIDR notation
} `json:"rules" url:"rules,key"`
Space struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
} `json:"space" url:"space,key"` // identity of space
}
// Current inbound ruleset for a space
func (s *Service) InboundRulesetCurrent(ctx context.Context, spaceIdentity string) (*InboundRuleset, error) {
var inboundRuleset InboundRuleset
return &inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-ruleset", spaceIdentity), nil, nil)
}
// Info on an existing Inbound Ruleset
func (s *Service) InboundRulesetInfo(ctx context.Context, spaceIdentity string, inboundRulesetIdentity string) (*InboundRuleset, error) {
var inboundRuleset InboundRuleset
return &inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-rulesets/%v", spaceIdentity, inboundRulesetIdentity), nil, nil)
}
type InboundRulesetListResult []InboundRuleset
// List all inbound rulesets for a space
func (s *Service) InboundRulesetList(ctx context.Context, spaceIdentity string, lr *ListRange) (InboundRulesetListResult, error) {
var inboundRuleset InboundRulesetListResult
return inboundRuleset, s.Get(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-rulesets", spaceIdentity), nil, lr)
}
type InboundRulesetCreateOpts struct {
Rules []*struct {
Action string `json:"action" url:"action,key"` // states whether the connection is allowed or denied
Source string `json:"source" url:"source,key"` // is the request’s source in CIDR notation
} `json:"rules,omitempty" url:"rules,omitempty,key"`
}
// Create a new inbound ruleset
func (s *Service) InboundRulesetCreate(ctx context.Context, spaceIdentity string, o InboundRulesetCreateOpts) (*InboundRuleset, error) {
var inboundRuleset InboundRuleset
return &inboundRuleset, s.Put(ctx, &inboundRuleset, fmt.Sprintf("/spaces/%v/inbound-ruleset", spaceIdentity), o)
}
// An invoice is an itemized bill of goods for an account which includes
// pricing and charges.
type Invoice struct {
ChargesTotal float64 `json:"charges_total" url:"charges_total,key"` // total charges on this invoice
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invoice was created
CreditsTotal float64 `json:"credits_total" url:"credits_total,key"` // total credits on this invoice
ID string `json:"id" url:"id,key"` // unique identifier of this invoice
Number int `json:"number" url:"number,key"` // human readable invoice number
PeriodEnd string `json:"period_end" url:"period_end,key"` // the ending date that the invoice covers
PeriodStart string `json:"period_start" url:"period_start,key"` // the starting date that this invoice covers
State int `json:"state" url:"state,key"` // payment status for this invoice (pending, successful, failed)
Total float64 `json:"total" url:"total,key"` // combined total of charges and credits on this invoice
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invoice was updated
}
// Info for existing invoice.
func (s *Service) InvoiceInfo(ctx context.Context, invoiceIdentity int) (*Invoice, error) {
var invoice Invoice
return &invoice, s.Get(ctx, &invoice, fmt.Sprintf("/account/invoices/%v", invoiceIdentity), nil, nil)
}
type InvoiceListResult []Invoice
// List existing invoices.
func (s *Service) InvoiceList(ctx context.Context, lr *ListRange) (InvoiceListResult, error) {
var invoice InvoiceListResult
return invoice, s.Get(ctx, &invoice, fmt.Sprintf("/account/invoices"), nil, lr)
}
// An invoice address represents the address that should be listed on an
// invoice.
type InvoiceAddress struct {
Address1 string `json:"address_1" url:"address_1,key"` // invoice street address line 1
Address2 string `json:"address_2" url:"address_2,key"` // invoice street address line 2
City string `json:"city" url:"city,key"` // invoice city
Country string `json:"country" url:"country,key"` // country
HerokuID string `json:"heroku_id" url:"heroku_id,key"` // heroku_id identifier reference
Other string `json:"other" url:"other,key"` // metadata / additional information to go on invoice
PostalCode string `json:"postal_code" url:"postal_code,key"` // invoice zip code
State string `json:"state" url:"state,key"` // invoice state
UseInvoiceAddress bool `json:"use_invoice_address" url:"use_invoice_address,key"` // flag to use the invoice address for an account or not
}
// Retrieve existing invoice address.
func (s *Service) InvoiceAddressInfo(ctx context.Context) (*InvoiceAddress, error) {
var invoiceAddress InvoiceAddress
return &invoiceAddress, s.Get(ctx, &invoiceAddress, fmt.Sprintf("/account/invoice-address"), nil, nil)
}
type InvoiceAddressUpdateOpts struct {
Address1 *string `json:"address_1,omitempty" url:"address_1,omitempty,key"` // invoice street address line 1
Address2 *string `json:"address_2,omitempty" url:"address_2,omitempty,key"` // invoice street address line 2
City *string `json:"city,omitempty" url:"city,omitempty,key"` // invoice city
Country *string `json:"country,omitempty" url:"country,omitempty,key"` // country
Other *string `json:"other,omitempty" url:"other,omitempty,key"` // metadata / additional information to go on invoice
PostalCode *string `json:"postal_code,omitempty" url:"postal_code,omitempty,key"` // invoice zip code
State *string `json:"state,omitempty" url:"state,omitempty,key"` // invoice state
UseInvoiceAddress *bool `json:"use_invoice_address,omitempty" url:"use_invoice_address,omitempty,key"` // flag to use the invoice address for an account or not
}
// Update invoice address for an account.
func (s *Service) InvoiceAddressUpdate(ctx context.Context, o InvoiceAddressUpdateOpts) (*InvoiceAddress, error) {
var invoiceAddress InvoiceAddress
return &invoiceAddress, s.Put(ctx, &invoiceAddress, fmt.Sprintf("/account/invoice-address"), o)
}
// Keys represent public SSH keys associated with an account and are
// used to authorize accounts as they are performing git operations.
type Key struct {
Comment string `json:"comment" url:"comment,key"` // comment on the key
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when key was created
Email string `json:"email" url:"email,key"` // deprecated. Please refer to 'comment' instead
Fingerprint string `json:"fingerprint" url:"fingerprint,key"` // a unique identifying string based on contents
ID string `json:"id" url:"id,key"` // unique identifier of this key
PublicKey string `json:"public_key" url:"public_key,key"` // full public_key as uploaded
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when key was updated
}
// Info for existing key.
func (s *Service) KeyInfo(ctx context.Context, keyIdentity string) (*Key, error) {
var key Key
return &key, s.Get(ctx, &key, fmt.Sprintf("/account/keys/%v", keyIdentity), nil, nil)
}
type KeyListResult []Key
// List existing keys.
func (s *Service) KeyList(ctx context.Context, lr *ListRange) (KeyListResult, error) {
var key KeyListResult
return key, s.Get(ctx, &key, fmt.Sprintf("/account/keys"), nil, lr)
}
// [Log drains](https://devcenter.heroku.com/articles/log-drains)
// provide a way to forward your Heroku logs to an external syslog
// server for long-term archiving. This external service must be
// configured to receive syslog packets from Heroku, whereupon its URL
// can be added to an app using this API. Some add-ons will add a log
// drain when they are provisioned to an app. These drains can only be
// removed by removing the add-on.
type LogDrain struct {
Addon *struct {
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
} `json:"addon" url:"addon,key"` // add-on that created the drain
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when log drain was created
ID string `json:"id" url:"id,key"` // unique identifier of this log drain
Token string `json:"token" url:"token,key"` // token associated with the log drain
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when log drain was updated
URL string `json:"url" url:"url,key"` // url associated with the log drain
}
type LogDrainCreateOpts struct {
URL string `json:"url" url:"url,key"` // url associated with the log drain
}
// Create a new log drain.
func (s *Service) LogDrainCreate(ctx context.Context, appIdentity string, o LogDrainCreateOpts) (*LogDrain, error) {
var logDrain LogDrain
return &logDrain, s.Post(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains", appIdentity), o)
}
type LogDrainUpdateOpts struct {
URL string `json:"url" url:"url,key"` // url associated with the log drain
}
// Update an add-on owned log drain.
func (s *Service) LogDrainUpdate(ctx context.Context, addOnIdentity string, logDrainQueryIdentity string, o LogDrainUpdateOpts) (*LogDrain, error) {
var logDrain LogDrain
return &logDrain, s.Put(ctx, &logDrain, fmt.Sprintf("/addons/%v/log-drains/%v", addOnIdentity, logDrainQueryIdentity), o)
}
// Delete an existing log drain. Log drains added by add-ons can only be
// removed by removing the add-on.
func (s *Service) LogDrainDelete(ctx context.Context, appIdentity string, logDrainQueryIdentity string) (*LogDrain, error) {
var logDrain LogDrain
return &logDrain, s.Delete(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains/%v", appIdentity, logDrainQueryIdentity))
}
// Info for existing log drain.
func (s *Service) LogDrainInfo(ctx context.Context, appIdentity string, logDrainQueryIdentity string) (*LogDrain, error) {
var logDrain LogDrain
return &logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains/%v", appIdentity, logDrainQueryIdentity), nil, nil)
}
type LogDrainListByAddOnResult []LogDrain
// List existing log drains for an add-on.
func (s *Service) LogDrainListByAddOn(ctx context.Context, addOnIdentity string, lr *ListRange) (LogDrainListByAddOnResult, error) {
var logDrain LogDrainListByAddOnResult
return logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/addons/%v/log-drains", addOnIdentity), nil, lr)
}
type LogDrainListResult []LogDrain
// List existing log drains.
func (s *Service) LogDrainList(ctx context.Context, appIdentity string, lr *ListRange) (LogDrainListResult, error) {
var logDrain LogDrainListResult
return logDrain, s.Get(ctx, &logDrain, fmt.Sprintf("/apps/%v/log-drains", appIdentity), nil, lr)
}
// A log session is a reference to the http based log stream for an app.
type LogSession struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when log connection was created
ID string `json:"id" url:"id,key"` // unique identifier of this log session
LogplexURL string `json:"logplex_url" url:"logplex_url,key"` // URL for log streaming session
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when log session was updated
}
type LogSessionCreateOpts struct {
Dyno *string `json:"dyno,omitempty" url:"dyno,omitempty,key"` // dyno to limit results to
Lines *int `json:"lines,omitempty" url:"lines,omitempty,key"` // number of log lines to stream at once
Source *string `json:"source,omitempty" url:"source,omitempty,key"` // log source to limit results to
Tail *bool `json:"tail,omitempty" url:"tail,omitempty,key"` // whether to stream ongoing logs
}
// Create a new log session.
func (s *Service) LogSessionCreate(ctx context.Context, appIdentity string, o LogSessionCreateOpts) (*LogSession, error) {
var logSession LogSession
return &logSession, s.Post(ctx, &logSession, fmt.Sprintf("/apps/%v/log-sessions", appIdentity), o)
}
// OAuth authorizations represent clients that a Heroku user has
// authorized to automate, customize or extend their usage of the
// platform. For more information please refer to the [Heroku OAuth
// documentation](https://devcenter.heroku.com/articles/oauth)
type OAuthAuthorization struct {
AccessToken *struct {
ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
// indefinite lifetime
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
} `json:"access_token" url:"access_token,key"` // access token for this authorization
Client *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this OAuth client
Name string `json:"name" url:"name,key"` // OAuth client name
RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
} `json:"client" url:"client,key"` // identifier of the client that obtained this authorization, if any
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth authorization was created
Grant *struct {
Code string `json:"code" url:"code,key"` // grant code received from OAuth web application authorization
ExpiresIn int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth grant expires
ID string `json:"id" url:"id,key"` // unique identifier of OAuth grant
} `json:"grant" url:"grant,key"` // this authorization's grant
ID string `json:"id" url:"id,key"` // unique identifier of OAuth authorization
RefreshToken *struct {
ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
// indefinite lifetime
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
} `json:"refresh_token" url:"refresh_token,key"` // refresh token for this authorization
Scope []string `json:"scope" url:"scope,key"` // The scope of access OAuth authorization allows
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth authorization was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
FullName *string `json:"full_name" url:"full_name,key"` // full name of the account owner
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // authenticated user associated with this authorization
}
type OAuthAuthorizationCreateOpts struct {
Client *string `json:"client,omitempty" url:"client,omitempty,key"` // unique identifier of this OAuth client
Description *string `json:"description,omitempty" url:"description,omitempty,key"` // human-friendly description of this OAuth authorization
ExpiresIn *int `json:"expires_in,omitempty" url:"expires_in,omitempty,key"` // seconds until OAuth token expires; may be `null` for tokens with
// indefinite lifetime
Scope []string `json:"scope" url:"scope,key"` // The scope of access OAuth authorization allows
}
// Create a new OAuth authorization.
func (s *Service) OAuthAuthorizationCreate(ctx context.Context, o OAuthAuthorizationCreateOpts) (*OAuthAuthorization, error) {
var oauthAuthorization OAuthAuthorization
return &oauthAuthorization, s.Post(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations"), o)
}
// Delete OAuth authorization.
func (s *Service) OAuthAuthorizationDelete(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
var oauthAuthorization OAuthAuthorization
return &oauthAuthorization, s.Delete(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v", oauthAuthorizationIdentity))
}
// Info for an OAuth authorization.
func (s *Service) OAuthAuthorizationInfo(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
var oauthAuthorization OAuthAuthorization
return &oauthAuthorization, s.Get(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v", oauthAuthorizationIdentity), nil, nil)
}
type OAuthAuthorizationListResult []OAuthAuthorization
// List OAuth authorizations.
func (s *Service) OAuthAuthorizationList(ctx context.Context, lr *ListRange) (OAuthAuthorizationListResult, error) {
var oauthAuthorization OAuthAuthorizationListResult
return oauthAuthorization, s.Get(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations"), nil, lr)
}
// Regenerate OAuth tokens. This endpoint is only available to direct
// authorizations or privileged OAuth clients.
func (s *Service) OAuthAuthorizationRegenerate(ctx context.Context, oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
var oauthAuthorization OAuthAuthorization
return &oauthAuthorization, s.Post(ctx, &oauthAuthorization, fmt.Sprintf("/oauth/authorizations/%v/actions/regenerate-tokens", oauthAuthorizationIdentity), nil)
}
// OAuth clients are applications that Heroku users can authorize to
// automate, customize or extend their usage of the platform. For more
// information please refer to the [Heroku OAuth
// documentation](https://devcenter.heroku.com/articles/oauth).
type OAuthClient struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth client was created
ID string `json:"id" url:"id,key"` // unique identifier of this OAuth client
IgnoresDelinquent *bool `json:"ignores_delinquent" url:"ignores_delinquent,key"` // whether the client is still operable given a delinquent account
Name string `json:"name" url:"name,key"` // OAuth client name
RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
Secret string `json:"secret" url:"secret,key"` // secret used to obtain OAuth authorizations under this client
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth client was updated
}
type OAuthClientCreateOpts struct {
Name string `json:"name" url:"name,key"` // OAuth client name
RedirectURI string `json:"redirect_uri" url:"redirect_uri,key"` // endpoint for redirection after authorization with OAuth client
}
// Create a new OAuth client.
func (s *Service) OAuthClientCreate(ctx context.Context, o OAuthClientCreateOpts) (*OAuthClient, error) {
var oauthClient OAuthClient
return &oauthClient, s.Post(ctx, &oauthClient, fmt.Sprintf("/oauth/clients"), o)
}
// Delete OAuth client.
func (s *Service) OAuthClientDelete(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
var oauthClient OAuthClient
return &oauthClient, s.Delete(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity))
}
// Info for an OAuth client
func (s *Service) OAuthClientInfo(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
var oauthClient OAuthClient
return &oauthClient, s.Get(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity), nil, nil)
}
type OAuthClientListResult []OAuthClient
// List OAuth clients
func (s *Service) OAuthClientList(ctx context.Context, lr *ListRange) (OAuthClientListResult, error) {
var oauthClient OAuthClientListResult
return oauthClient, s.Get(ctx, &oauthClient, fmt.Sprintf("/oauth/clients"), nil, lr)
}
type OAuthClientUpdateOpts struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // OAuth client name
RedirectURI *string `json:"redirect_uri,omitempty" url:"redirect_uri,omitempty,key"` // endpoint for redirection after authorization with OAuth client
}
// Update OAuth client
func (s *Service) OAuthClientUpdate(ctx context.Context, oauthClientIdentity string, o OAuthClientUpdateOpts) (*OAuthClient, error) {
var oauthClient OAuthClient
return &oauthClient, s.Patch(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v", oauthClientIdentity), o)
}
// Rotate credentials for an OAuth client
func (s *Service) OAuthClientRotateCredentials(ctx context.Context, oauthClientIdentity string) (*OAuthClient, error) {
var oauthClient OAuthClient
return &oauthClient, s.Post(ctx, &oauthClient, fmt.Sprintf("/oauth/clients/%v/actions/rotate-credentials", oauthClientIdentity), nil)
}
// OAuth grants are used to obtain authorizations on behalf of a user.
// For more information please refer to the [Heroku OAuth
// documentation](https://devcenter.heroku.com/articles/oauth)
type OAuthGrant struct{}
// OAuth tokens provide access for authorized clients to act on behalf
// of a Heroku user to automate, customize or extend their usage of the
// platform. For more information please refer to the [Heroku OAuth
// documentation](https://devcenter.heroku.com/articles/oauth)
type OAuthToken struct {
AccessToken struct {
ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
// indefinite lifetime
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
} `json:"access_token" url:"access_token,key"` // current access token
Authorization struct {
ID string `json:"id" url:"id,key"` // unique identifier of OAuth authorization
} `json:"authorization" url:"authorization,key"` // authorization for this set of tokens
Client *struct {
Secret string `json:"secret" url:"secret,key"` // secret used to obtain OAuth authorizations under this client
} `json:"client" url:"client,key"` // OAuth client secret used to obtain token
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when OAuth token was created
Grant struct {
Code string `json:"code" url:"code,key"` // grant code received from OAuth web application authorization
Type string `json:"type" url:"type,key"` // type of grant requested, one of `authorization_code` or
// `refresh_token`
} `json:"grant" url:"grant,key"` // grant used on the underlying authorization
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
RefreshToken struct {
ExpiresIn *int `json:"expires_in" url:"expires_in,key"` // seconds until OAuth token expires; may be `null` for tokens with
// indefinite lifetime
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
Token string `json:"token" url:"token,key"` // contents of the token to be used for authorization
} `json:"refresh_token" url:"refresh_token,key"` // refresh token for this authorization
Session struct {
ID string `json:"id" url:"id,key"` // unique identifier of OAuth token
} `json:"session" url:"session,key"` // OAuth session using this token
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when OAuth token was updated
User struct {
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // Reference to the user associated with this token
}
type OAuthTokenCreateOpts struct {
Client struct {
Secret *string `json:"secret,omitempty" url:"secret,omitempty,key"` // secret used to obtain OAuth authorizations under this client
} `json:"client" url:"client,key"`
Grant struct {
Code *string `json:"code,omitempty" url:"code,omitempty,key"` // grant code received from OAuth web application authorization
Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of grant requested, one of `authorization_code` or
// `refresh_token`
} `json:"grant" url:"grant,key"`
RefreshToken struct {
Token *string `json:"token,omitempty" url:"token,omitempty,key"` // contents of the token to be used for authorization
} `json:"refresh_token" url:"refresh_token,key"`
}
// Create a new OAuth token.
func (s *Service) OAuthTokenCreate(ctx context.Context, o OAuthTokenCreateOpts) (*OAuthToken, error) {
var oauthToken OAuthToken
return &oauthToken, s.Post(ctx, &oauthToken, fmt.Sprintf("/oauth/tokens"), o)
}
// Revoke OAuth access token.
func (s *Service) OAuthTokenDelete(ctx context.Context, oauthTokenIdentity string) (*OAuthToken, error) {
var oauthToken OAuthToken
return &oauthToken, s.Delete(ctx, &oauthToken, fmt.Sprintf("/oauth/tokens/%v", oauthTokenIdentity))
}
// An outbound-ruleset is a collection of rules that specify what hosts
// Dynos are allowed to communicate with.
type OutboundRuleset struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when outbound-ruleset was created
CreatedBy string `json:"created_by" url:"created_by,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an outbound-ruleset
Rules []struct {
FromPort int `json:"from_port" url:"from_port,key"` // an endpoint of communication in an operating system.
Protocol string `json:"protocol" url:"protocol,key"` // formal standards and policies comprised of rules, procedures and
// formats that define communication between two or more devices over a
// network
Target string `json:"target" url:"target,key"` // is the target destination in CIDR notation
ToPort int `json:"to_port" url:"to_port,key"` // an endpoint of communication in an operating system.
} `json:"rules" url:"rules,key"`
Space struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
} `json:"space" url:"space,key"` // identity of space
}
// Current outbound ruleset for a space
func (s *Service) OutboundRulesetCurrent(ctx context.Context, spaceIdentity string) (*OutboundRuleset, error) {
var outboundRuleset OutboundRuleset
return &outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-ruleset", spaceIdentity), nil, nil)
}
// Info on an existing Outbound Ruleset
func (s *Service) OutboundRulesetInfo(ctx context.Context, spaceIdentity string, outboundRulesetIdentity string) (*OutboundRuleset, error) {
var outboundRuleset OutboundRuleset
return &outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-rulesets/%v", spaceIdentity, outboundRulesetIdentity), nil, nil)
}
type OutboundRulesetListResult []OutboundRuleset
// List all Outbound Rulesets for a space
func (s *Service) OutboundRulesetList(ctx context.Context, spaceIdentity string, lr *ListRange) (OutboundRulesetListResult, error) {
var outboundRuleset OutboundRulesetListResult
return outboundRuleset, s.Get(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-rulesets", spaceIdentity), nil, lr)
}
type OutboundRulesetCreateOpts struct {
Rules []*struct {
FromPort int `json:"from_port" url:"from_port,key"` // an endpoint of communication in an operating system.
Protocol string `json:"protocol" url:"protocol,key"` // formal standards and policies comprised of rules, procedures and
// formats that define communication between two or more devices over a
// network
Target string `json:"target" url:"target,key"` // is the target destination in CIDR notation
ToPort int `json:"to_port" url:"to_port,key"` // an endpoint of communication in an operating system.
} `json:"rules,omitempty" url:"rules,omitempty,key"`
}
// Create a new outbound ruleset
func (s *Service) OutboundRulesetCreate(ctx context.Context, spaceIdentity string, o OutboundRulesetCreateOpts) (*OutboundRuleset, error) {
var outboundRuleset OutboundRuleset
return &outboundRuleset, s.Put(ctx, &outboundRuleset, fmt.Sprintf("/spaces/%v/outbound-ruleset", spaceIdentity), o)
}
// A password reset represents a in-process password reset attempt.
type PasswordReset struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when password reset was created
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"`
}
type PasswordResetResetPasswordOpts struct {
Email *string `json:"email,omitempty" url:"email,omitempty,key"` // unique email address of account
}
// Reset account's password. This will send a reset password link to the
// user's email address.
func (s *Service) PasswordResetResetPassword(ctx context.Context, o PasswordResetResetPasswordOpts) (*PasswordReset, error) {
var passwordReset PasswordReset
return &passwordReset, s.Post(ctx, &passwordReset, fmt.Sprintf("/password-resets"), o)
}
type PasswordResetCompleteResetPasswordOpts struct {
Password *string `json:"password,omitempty" url:"password,omitempty,key"` // current password on the account
PasswordConfirmation *string `json:"password_confirmation,omitempty" url:"password_confirmation,omitempty,key"` // confirmation of the new password
}
// Complete password reset.
func (s *Service) PasswordResetCompleteResetPassword(ctx context.Context, passwordResetResetPasswordToken string, o PasswordResetCompleteResetPasswordOpts) (*PasswordReset, error) {
var passwordReset PasswordReset
return &passwordReset, s.Post(ctx, &passwordReset, fmt.Sprintf("/password-resets/%v/actions/finalize", passwordResetResetPasswordToken), o)
}
// [Peering](https://devcenter.heroku.com/articles/private-space-peering)
// provides a way to peer your Private Space VPC to another AWS VPC.
type Peering struct {
AwsAccountID string `json:"aws_account_id" url:"aws_account_id,key"` // The AWS account ID of your Private Space.
AwsRegion string `json:"aws_region" url:"aws_region,key"` // The AWS region of the peer connection.
AwsVpcID string `json:"aws_vpc_id" url:"aws_vpc_id,key"` // The AWS VPC ID of the peer.
CIDRBlocks []string `json:"cidr_blocks" url:"cidr_blocks,key"` // The CIDR blocks of the peer.
Expires time.Time `json:"expires" url:"expires,key"` // When a peering connection will expire.
PcxID string `json:"pcx_id" url:"pcx_id,key"` // The AWS VPC Peering Connection ID of the peering.
Status string `json:"status" url:"status,key"` // The status of the peering connection.
Type string `json:"type" url:"type,key"` // The type of peering connection.
}
type PeeringListResult []Peering
// List peering connections of a private space.
func (s *Service) PeeringList(ctx context.Context, spaceIdentity string, lr *ListRange) (PeeringListResult, error) {
var peering PeeringListResult
return peering, s.Get(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings", spaceIdentity), nil, lr)
}
// Accept a pending peering connection with a private space.
func (s *Service) PeeringAccept(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
var peering Peering
return &peering, s.Post(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v/actions/accept", spaceIdentity, peeringPcxID), nil)
}
// Destroy an active peering connection with a private space.
func (s *Service) PeeringDestroy(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
var peering Peering
return &peering, s.Delete(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v", spaceIdentity, peeringPcxID))
}
// Fetch information for existing peering connection
func (s *Service) PeeringInfo(ctx context.Context, spaceIdentity string, peeringPcxID string) (*Peering, error) {
var peering Peering
return &peering, s.Get(ctx, &peering, fmt.Sprintf("/spaces/%v/peerings/%v", spaceIdentity, peeringPcxID), nil, nil)
}
// [Peering
// Info](https://devcenter.heroku.com/articles/private-space-peering)
// gives you the information necessary to peer an AWS VPC to a Private
// Space.
type PeeringInfo struct {
AwsAccountID string `json:"aws_account_id" url:"aws_account_id,key"` // The AWS account ID of your Private Space.
AwsRegion string `json:"aws_region" url:"aws_region,key"` // region name used by provider
DynoCIDRBlocks []string `json:"dyno_cidr_blocks" url:"dyno_cidr_blocks,key"` // The CIDR ranges that should be routed to the Private Space VPC.
SpaceCIDRBlocks []string `json:"space_cidr_blocks" url:"space_cidr_blocks,key"` // The CIDR ranges that should be routed to the Private Space VPC.
UnavailableCIDRBlocks []string `json:"unavailable_cidr_blocks" url:"unavailable_cidr_blocks,key"` // The CIDR ranges that you must not conflict with.
VpcCIDR string `json:"vpc_cidr" url:"vpc_cidr,key"` // An IP address and the number of significant bits that make up the
// routing or networking portion.
VpcID string `json:"vpc_id" url:"vpc_id,key"` // The AWS VPC ID of the peer.
}
// Provides the necessary information to establish an AWS VPC Peering
// with your private space.
func (s *Service) PeeringInfoInfo(ctx context.Context, spaceIdentity string) (*PeeringInfo, error) {
var peeringInfo PeeringInfo
return &peeringInfo, s.Get(ctx, &peeringInfo, fmt.Sprintf("/spaces/%v/peering-info", spaceIdentity), nil, nil)
}
// An owned entity including users' permissions.
type PermissionEntity struct {
ID string `json:"id" url:"id,key"` // ID of the entity.
Name string `json:"name" url:"name,key"` // Name of the entity.
TeamID string `json:"team_id" url:"team_id,key"` // unique identifier of team
Type string `json:"type" url:"type,key"` // The type of object the entity is referring to.
Users []struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
Permissions []string `json:"permissions" url:"permissions,key"` // enterprise account permissions
} `json:"users" url:"users,key"` // Users that have access to the entity.
}
type PermissionEntityListResult []PermissionEntity
// List permission entities for a team.
func (s *Service) PermissionEntityList(ctx context.Context, teamIdentity string, lr *ListRange) (PermissionEntityListResult, error) {
var permissionEntity PermissionEntityListResult
return permissionEntity, s.Get(ctx, &permissionEntity, fmt.Sprintf("/teams/%v/permissions", teamIdentity), nil, lr)
}
// A pipeline allows grouping of apps into different stages.
type Pipeline struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when pipeline was created
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
Name string `json:"name" url:"name,key"` // name of pipeline
Owner *struct {
ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
Type string `json:"type" url:"type,key"` // type of pipeline owner
} `json:"owner" url:"owner,key"` // Owner of a pipeline.
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when pipeline was updated
}
type PipelineCreateOpts struct {
Name string `json:"name" url:"name,key"` // name of pipeline
Owner *struct {
ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
Type string `json:"type" url:"type,key"` // type of pipeline owner
} `json:"owner,omitempty" url:"owner,omitempty,key"` // Owner of a pipeline.
}
// Create a new pipeline.
func (s *Service) PipelineCreate(ctx context.Context, o PipelineCreateOpts) (*Pipeline, error) {
var pipeline Pipeline
return &pipeline, s.Post(ctx, &pipeline, fmt.Sprintf("/pipelines"), o)
}
// Info for existing pipeline.
func (s *Service) PipelineInfo(ctx context.Context, pipelineIdentity string) (*Pipeline, error) {
var pipeline Pipeline
return &pipeline, s.Get(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineIdentity), nil, nil)
}
// Delete an existing pipeline.
func (s *Service) PipelineDelete(ctx context.Context, pipelineID string) (*Pipeline, error) {
var pipeline Pipeline
return &pipeline, s.Delete(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineID))
}
type PipelineUpdateOpts struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // name of pipeline
}
// Update an existing pipeline.
func (s *Service) PipelineUpdate(ctx context.Context, pipelineID string, o PipelineUpdateOpts) (*Pipeline, error) {
var pipeline Pipeline
return &pipeline, s.Patch(ctx, &pipeline, fmt.Sprintf("/pipelines/%v", pipelineID), o)
}
type PipelineListResult []Pipeline
// List existing pipelines.
func (s *Service) PipelineList(ctx context.Context, lr *ListRange) (PipelineListResult, error) {
var pipeline PipelineListResult
return pipeline, s.Get(ctx, &pipeline, fmt.Sprintf("/pipelines"), nil, lr)
}
// Information about latest builds of apps in a pipeline.
type PipelineBuild struct{}
type PipelineBuildListResult []struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // app that the build belongs to
Buildpacks []struct {
Name string `json:"name" url:"name,key"` // Buildpack Registry name of the buildpack for the app
URL string `json:"url" url:"url,key"` // the URL of the buildpack for the app
} `json:"buildpacks" url:"buildpacks,key"` // buildpacks executed for this build, in order
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when build was created
ID string `json:"id" url:"id,key"` // unique identifier of build
OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // Build process output will be available from this URL as a stream. The
// stream is available as either `text/plain` or `text/event-stream`.
// Clients should be prepared to handle disconnects and can resume the
// stream by sending a `Range` header (for `text/plain`) or a
// `Last-Event-Id` header (for `text/event-stream`).
Release *struct {
ID string `json:"id" url:"id,key"` // unique identifier of release
} `json:"release" url:"release,key"` // release resulting from the build
Slug *struct {
ID string `json:"id" url:"id,key"` // unique identifier of slug
} `json:"slug" url:"slug,key"` // slug created by this build
SourceBlob struct {
Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the gzipped tarball for verifying its
// integrity
URL string `json:"url" url:"url,key"` // URL where gzipped tar archive of source code for build was
// downloaded.
Version *string `json:"version" url:"version,key"` // Version of the gzipped tarball.
} `json:"source_blob" url:"source_blob,key"` // location of gzipped tarball of source code used to create build
Stack string `json:"stack" url:"stack,key"` // stack of build
Status string `json:"status" url:"status,key"` // status of build
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when build was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user that started the build
}
// List latest builds for each app in a pipeline
func (s *Service) PipelineBuildList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineBuildListResult, error) {
var pipelineBuild PipelineBuildListResult
return pipelineBuild, s.Get(ctx, &pipelineBuild, fmt.Sprintf("/pipelines/%v/latest-builds", pipelineID), nil, lr)
}
// Pipeline Config Vars allow you to manage the configuration
// information provided to a pipeline.
type PipelineConfigVar map[string]string
type PipelineConfigVarInfoForAppResult map[string]*string
// Get config-vars for a pipeline stage.
func (s *Service) PipelineConfigVarInfoForApp(ctx context.Context, pipelineID string, pipelineCouplingStage string) (PipelineConfigVarInfoForAppResult, error) {
var pipelineConfigVar PipelineConfigVarInfoForAppResult
return pipelineConfigVar, s.Get(ctx, &pipelineConfigVar, fmt.Sprintf("/pipelines/%v/stage/%v/config-vars", pipelineID, pipelineCouplingStage), nil, nil)
}
type PipelineConfigVarUpdateResult map[string]*string
// Update config-vars for a pipeline stage. You can update existing
// config-vars by setting them again, and remove by setting it to
// `null`.
func (s *Service) PipelineConfigVarUpdate(ctx context.Context, pipelineID string, pipelineCouplingStage string, o map[string]*string) (PipelineConfigVarUpdateResult, error) {
var pipelineConfigVar PipelineConfigVarUpdateResult
return pipelineConfigVar, s.Patch(ctx, &pipelineConfigVar, fmt.Sprintf("/pipelines/%v/stage/%v/config-vars", pipelineID, pipelineCouplingStage), o)
}
// Information about an app's coupling to a pipeline
type PipelineCoupling struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // app involved in the pipeline coupling
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when pipeline coupling was created
ID string `json:"id" url:"id,key"` // unique identifier of pipeline coupling
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // pipeline involved in the coupling
Stage string `json:"stage" url:"stage,key"` // target pipeline stage
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when pipeline coupling was updated
}
type PipelineCouplingListByPipelineResult []PipelineCoupling
// List couplings for a pipeline
func (s *Service) PipelineCouplingListByPipeline(ctx context.Context, pipelineID string, lr *ListRange) (PipelineCouplingListByPipelineResult, error) {
var pipelineCoupling PipelineCouplingListByPipelineResult
return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipelines/%v/pipeline-couplings", pipelineID), nil, lr)
}
type PipelineCouplingListByCurrentUserResult []PipelineCoupling
// List pipeline couplings for the current user.
func (s *Service) PipelineCouplingListByCurrentUser(ctx context.Context, lr *ListRange) (PipelineCouplingListByCurrentUserResult, error) {
var pipelineCoupling PipelineCouplingListByCurrentUserResult
return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/users/~/pipeline-couplings"), nil, lr)
}
type PipelineCouplingListResult []PipelineCoupling
// List pipeline couplings.
func (s *Service) PipelineCouplingList(ctx context.Context, lr *ListRange) (PipelineCouplingListResult, error) {
var pipelineCoupling PipelineCouplingListResult
return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings"), nil, lr)
}
type PipelineCouplingListByTeamResult []PipelineCoupling
// List pipeline couplings for a team.
func (s *Service) PipelineCouplingListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (PipelineCouplingListByTeamResult, error) {
var pipelineCoupling PipelineCouplingListByTeamResult
return pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/teams/%v/pipeline-couplings", teamIdentity), nil, lr)
}
type PipelineCouplingCreateOpts struct {
App string `json:"app" url:"app,key"` // unique identifier of app
Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
Stage string `json:"stage" url:"stage,key"` // target pipeline stage
}
// Create a new pipeline coupling.
func (s *Service) PipelineCouplingCreate(ctx context.Context, o PipelineCouplingCreateOpts) (*PipelineCoupling, error) {
var pipelineCoupling PipelineCoupling
return &pipelineCoupling, s.Post(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings"), o)
}
// Info for an existing pipeline coupling.
func (s *Service) PipelineCouplingInfo(ctx context.Context, pipelineCouplingIdentity string) (*PipelineCoupling, error) {
var pipelineCoupling PipelineCoupling
return &pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity), nil, nil)
}
// Delete an existing pipeline coupling.
func (s *Service) PipelineCouplingDelete(ctx context.Context, pipelineCouplingIdentity string) (*PipelineCoupling, error) {
var pipelineCoupling PipelineCoupling
return &pipelineCoupling, s.Delete(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity))
}
type PipelineCouplingUpdateOpts struct {
Stage *string `json:"stage,omitempty" url:"stage,omitempty,key"` // target pipeline stage
}
// Update an existing pipeline coupling.
func (s *Service) PipelineCouplingUpdate(ctx context.Context, pipelineCouplingIdentity string, o PipelineCouplingUpdateOpts) (*PipelineCoupling, error) {
var pipelineCoupling PipelineCoupling
return &pipelineCoupling, s.Patch(ctx, &pipelineCoupling, fmt.Sprintf("/pipeline-couplings/%v", pipelineCouplingIdentity), o)
}
// Info for an existing pipeline coupling.
func (s *Service) PipelineCouplingInfoByApp(ctx context.Context, appIdentity string) (*PipelineCoupling, error) {
var pipelineCoupling PipelineCoupling
return &pipelineCoupling, s.Get(ctx, &pipelineCoupling, fmt.Sprintf("/apps/%v/pipeline-couplings", appIdentity), nil, nil)
}
// Information about latest deployments of apps in a pipeline.
type PipelineDeployment struct{}
type PipelineDeploymentListResult []struct {
AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app involved in the release
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
Description string `json:"description" url:"description,key"` // description of changes in this release
ID string `json:"id" url:"id,key"` // unique identifier of release
OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
// The stream is available as either `text/plain` or
// `text/event-stream`. Clients should be prepared to handle disconnects
// and can resume the stream by sending a `Range` header (for
// `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
Slug *struct {
ID string `json:"id" url:"id,key"` // unique identifier of slug
} `json:"slug" url:"slug,key"` // slug running in this release
Status string `json:"status" url:"status,key"` // current status of the release
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user that created the release
Version int `json:"version" url:"version,key"` // unique version assigned to the release
}
// List latest slug releases for each app in a pipeline
func (s *Service) PipelineDeploymentList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineDeploymentListResult, error) {
var pipelineDeployment PipelineDeploymentListResult
return pipelineDeployment, s.Get(ctx, &pipelineDeployment, fmt.Sprintf("/pipelines/%v/latest-deployments", pipelineID), nil, lr)
}
// Promotions allow you to move code from an app in a pipeline to all
// targets
type PipelinePromotion struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when promotion was created
ID string `json:"id" url:"id,key"` // unique identifier of promotion
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // the pipeline which the promotion belongs to
Source struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // the app which was promoted from
Release struct {
ID string `json:"id" url:"id,key"` // unique identifier of release
} `json:"release" url:"release,key"` // the release used to promoted from
} `json:"source" url:"source,key"` // the app being promoted from
Status string `json:"status" url:"status,key"` // status of promotion
UpdatedAt *time.Time `json:"updated_at" url:"updated_at,key"` // when promotion was updated
}
type PipelinePromotionCreateOpts struct {
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // pipeline involved in the promotion
Source struct {
App *struct {
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of app
} `json:"app,omitempty" url:"app,omitempty,key"` // the app which was promoted from
} `json:"source" url:"source,key"` // the app being promoted from
Targets []struct {
App *struct {
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of app
} `json:"app,omitempty" url:"app,omitempty,key"` // the app is being promoted to
} `json:"targets" url:"targets,key"`
}
// Create a new promotion.
func (s *Service) PipelinePromotionCreate(ctx context.Context, o PipelinePromotionCreateOpts) (*PipelinePromotion, error) {
var pipelinePromotion PipelinePromotion
return &pipelinePromotion, s.Post(ctx, &pipelinePromotion, fmt.Sprintf("/pipeline-promotions"), o)
}
// Info for existing pipeline promotion.
func (s *Service) PipelinePromotionInfo(ctx context.Context, pipelinePromotionIdentity string) (*PipelinePromotion, error) {
var pipelinePromotion PipelinePromotion
return &pipelinePromotion, s.Get(ctx, &pipelinePromotion, fmt.Sprintf("/pipeline-promotions/%v", pipelinePromotionIdentity), nil, nil)
}
// Promotion targets represent an individual app being promoted to
type PipelinePromotionTarget struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // the app which was promoted to
ErrorMessage *string `json:"error_message" url:"error_message,key"` // an error message for why the promotion failed
ID string `json:"id" url:"id,key"` // unique identifier of promotion target
PipelinePromotion struct {
ID string `json:"id" url:"id,key"` // unique identifier of promotion
} `json:"pipeline_promotion" url:"pipeline_promotion,key"` // the promotion which the target belongs to
Release *struct {
ID string `json:"id" url:"id,key"` // unique identifier of release
} `json:"release" url:"release,key"` // the release which was created on the target app
Status string `json:"status" url:"status,key"` // status of promotion
}
type PipelinePromotionTargetListResult []PipelinePromotionTarget
// List promotion targets belonging to an existing promotion.
func (s *Service) PipelinePromotionTargetList(ctx context.Context, pipelinePromotionID string, lr *ListRange) (PipelinePromotionTargetListResult, error) {
var pipelinePromotionTarget PipelinePromotionTargetListResult
return pipelinePromotionTarget, s.Get(ctx, &pipelinePromotionTarget, fmt.Sprintf("/pipeline-promotions/%v/promotion-targets", pipelinePromotionID), nil, lr)
}
// Information about latest releases of apps in a pipeline.
type PipelineRelease struct{}
type PipelineReleaseListResult []struct {
AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app involved in the release
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
Description string `json:"description" url:"description,key"` // description of changes in this release
ID string `json:"id" url:"id,key"` // unique identifier of release
OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
// The stream is available as either `text/plain` or
// `text/event-stream`. Clients should be prepared to handle disconnects
// and can resume the stream by sending a `Range` header (for
// `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
Slug *struct {
ID string `json:"id" url:"id,key"` // unique identifier of slug
} `json:"slug" url:"slug,key"` // slug running in this release
Status string `json:"status" url:"status,key"` // current status of the release
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user that created the release
Version int `json:"version" url:"version,key"` // unique version assigned to the release
}
// List latest releases for each app in a pipeline
func (s *Service) PipelineReleaseList(ctx context.Context, pipelineID string, lr *ListRange) (PipelineReleaseListResult, error) {
var pipelineRelease PipelineReleaseListResult
return pipelineRelease, s.Get(ctx, &pipelineRelease, fmt.Sprintf("/pipelines/%v/latest-releases", pipelineID), nil, lr)
}
// A pipeline's stack is determined by the apps in the pipeline. This is
// used during creation of CI and Review Apps that have no stack defined
// in app.json
type PipelineStack struct {
Stack *struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of the stack that will be used for new builds without a
// stack defined in CI and Review Apps
}
// The stack for a given pipeline, used for CI and Review Apps that have
// no stack defined in app.json.
func (s *Service) PipelineStackDefaultStack(ctx context.Context, pipelineID string) (*PipelineStack, error) {
var pipelineStack PipelineStack
return &pipelineStack, s.Get(ctx, &pipelineStack, fmt.Sprintf("/pipelines/%v/pipeline-stack", pipelineID), nil, nil)
}
// A pipeline transfer is the process of changing pipeline ownership
// along with the contained apps.
type PipelineTransfer struct {
NewOwner *struct {
ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
Type string `json:"type" url:"type,key"` // type of pipeline owner
} `json:"new_owner" url:"new_owner,key"` // Owner of a pipeline.
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // pipeline being transferred
PreviousOwner *struct {
ID string `json:"id" url:"id,key"` // unique identifier of a pipeline owner
Type string `json:"type" url:"type,key"` // type of pipeline owner
} `json:"previous_owner" url:"previous_owner,key"` // Owner of a pipeline.
}
type PipelineTransferCreateOpts struct {
NewOwner struct {
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of a pipeline owner
Type *string `json:"type,omitempty" url:"type,omitempty,key"` // type of pipeline owner
} `json:"new_owner" url:"new_owner,key"` // New pipeline owner
Pipeline struct {
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // The pipeline to transfer
}
// Create a new pipeline transfer.
func (s *Service) PipelineTransferCreate(ctx context.Context, o PipelineTransferCreateOpts) (*PipelineTransfer, error) {
var pipelineTransfer PipelineTransfer
return &pipelineTransfer, s.Post(ctx, &pipelineTransfer, fmt.Sprintf("/pipeline-transfers"), o)
}
// Plans represent different configurations of add-ons that may be added
// to apps. Endpoints under add-on services can be accessed without
// authentication.
type Plan struct {
AddonService struct {
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // identity of add-on service
Compliance []string `json:"compliance" url:"compliance,key"` // the compliance regimes applied to an add-on plan
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when plan was created
Default bool `json:"default" url:"default,key"` // whether this plan is the default for its add-on service
Description string `json:"description" url:"description,key"` // description of plan
HumanName string `json:"human_name" url:"human_name,key"` // human readable name of the add-on plan
ID string `json:"id" url:"id,key"` // unique identifier of this plan
InstallableInsidePrivateNetwork bool `json:"installable_inside_private_network" url:"installable_inside_private_network,key"` // whether this plan is installable to a Private Spaces app
InstallableOutsidePrivateNetwork bool `json:"installable_outside_private_network" url:"installable_outside_private_network,key"` // whether this plan is installable to a Common Runtime app
Name string `json:"name" url:"name,key"` // unique name of this plan
Price struct {
Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
Unit string `json:"unit" url:"unit,key"` // unit of price for plan
} `json:"price" url:"price,key"` // price
SpaceDefault bool `json:"space_default" url:"space_default,key"` // whether this plan is the default for apps in Private Spaces
State string `json:"state" url:"state,key"` // release status for plan
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when plan was updated
Visible bool `json:"visible" url:"visible,key"` // whether this plan is publicly visible
}
// Info for existing plan.
func (s *Service) PlanInfo(ctx context.Context, planIdentity string) (*Plan, error) {
var plan Plan
return &plan, s.Get(ctx, &plan, fmt.Sprintf("/plans/%v", planIdentity), nil, nil)
}
// Info for existing plan by Add-on.
func (s *Service) PlanInfoByAddOn(ctx context.Context, addOnServiceIdentity string, planIdentity string) (*Plan, error) {
var plan Plan
return &plan, s.Get(ctx, &plan, fmt.Sprintf("/addon-services/%v/plans/%v", addOnServiceIdentity, planIdentity), nil, nil)
}
type PlanListByAddOnResult []Plan
// List existing plans by Add-on.
func (s *Service) PlanListByAddOn(ctx context.Context, addOnServiceIdentity string, lr *ListRange) (PlanListByAddOnResult, error) {
var plan PlanListByAddOnResult
return plan, s.Get(ctx, &plan, fmt.Sprintf("/addon-services/%v/plans", addOnServiceIdentity), nil, lr)
}
// Rate Limit represents the number of request tokens each account
// holds. Requests to this endpoint do not count towards the rate limit.
type RateLimit struct {
Remaining int `json:"remaining" url:"remaining,key"` // allowed requests remaining in current interval
}
// Info for rate limits.
func (s *Service) RateLimitInfo(ctx context.Context) (*RateLimit, error) {
var rateLimit RateLimit
return &rateLimit, s.Get(ctx, &rateLimit, fmt.Sprintf("/account/rate-limits"), nil, nil)
}
// A region represents a geographic location in which your application
// may run.
type Region struct {
Country string `json:"country" url:"country,key"` // country where the region exists
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when region was created
Description string `json:"description" url:"description,key"` // description of region
ID string `json:"id" url:"id,key"` // unique identifier of region
Locale string `json:"locale" url:"locale,key"` // area in the country where the region exists
Name string `json:"name" url:"name,key"` // unique name of region
PrivateCapable bool `json:"private_capable" url:"private_capable,key"` // whether or not region is available for creating a Private Space
Provider struct {
Name string `json:"name" url:"name,key"` // name of provider
Region string `json:"region" url:"region,key"` // region name used by provider
} `json:"provider" url:"provider,key"` // provider of underlying substrate
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when region was updated
}
// Info for existing region.
func (s *Service) RegionInfo(ctx context.Context, regionIdentity string) (*Region, error) {
var region Region
return ®ion, s.Get(ctx, ®ion, fmt.Sprintf("/regions/%v", regionIdentity), nil, nil)
}
type RegionListResult []Region
// List existing regions.
func (s *Service) RegionList(ctx context.Context, lr *ListRange) (RegionListResult, error) {
var region RegionListResult
return region, s.Get(ctx, ®ion, fmt.Sprintf("/regions"), nil, lr)
}
// A release represents a combination of code, config vars and add-ons
// for an app on Heroku.
type Release struct {
AddonPlanNames []string `json:"addon_plan_names" url:"addon_plan_names,key"` // add-on plans installed on the app for this release
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app involved in the release
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when release was created
Current bool `json:"current" url:"current,key"` // indicates this release as being the current one for the app
Description string `json:"description" url:"description,key"` // description of changes in this release
ID string `json:"id" url:"id,key"` // unique identifier of release
OutputStreamURL *string `json:"output_stream_url" url:"output_stream_url,key"` // Release command output will be available from this URL as a stream.
// The stream is available as either `text/plain` or
// `text/event-stream`. Clients should be prepared to handle disconnects
// and can resume the stream by sending a `Range` header (for
// `text/plain`) or a `Last-Event-Id` header (for `text/event-stream`).
Slug *struct {
ID string `json:"id" url:"id,key"` // unique identifier of slug
} `json:"slug" url:"slug,key"` // slug running in this release
Status string `json:"status" url:"status,key"` // current status of the release
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when release was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // user that created the release
Version int `json:"version" url:"version,key"` // unique version assigned to the release
}
// Info for existing release.
func (s *Service) ReleaseInfo(ctx context.Context, appIdentity string, releaseIdentity string) (*Release, error) {
var release Release
return &release, s.Get(ctx, &release, fmt.Sprintf("/apps/%v/releases/%v", appIdentity, releaseIdentity), nil, nil)
}
type ReleaseListResult []Release
// List existing releases.
func (s *Service) ReleaseList(ctx context.Context, appIdentity string, lr *ListRange) (ReleaseListResult, error) {
var release ReleaseListResult
return release, s.Get(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), nil, lr)
}
type ReleaseCreateOpts struct {
Description *string `json:"description,omitempty" url:"description,omitempty,key"` // description of changes in this release
Slug string `json:"slug" url:"slug,key"` // unique identifier of slug
}
// Create new release.
func (s *Service) ReleaseCreate(ctx context.Context, appIdentity string, o ReleaseCreateOpts) (*Release, error) {
var release Release
return &release, s.Post(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), o)
}
type ReleaseRollbackOpts struct {
Release string `json:"release" url:"release,key"` // unique identifier of release
}
// Rollback to an existing release.
func (s *Service) ReleaseRollback(ctx context.Context, appIdentity string, o ReleaseRollbackOpts) (*Release, error) {
var release Release
return &release, s.Post(ctx, &release, fmt.Sprintf("/apps/%v/releases", appIdentity), o)
}
// An ephemeral app to review a set of changes
type ReviewApp struct {
App *struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"app" url:"app,key"` // the Heroku app associated to this review app
AppSetup *struct {
ID string `json:"id" url:"id,key"` // unique identifier of app setup
} `json:"app_setup" url:"app_setup,key"` // the app setup for this review app
Branch string `json:"branch" url:"branch,key"` // the branch of the repository which the review app is based on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test run was created
Creator struct{} `json:"creator" url:"creator,key"` // The user who created the review app
ErrorStatus *string `json:"error_status" url:"error_status,key"` // error message from creating the review app if any
ForkRepo *struct {
ID *int `json:"id" url:"id,key"` // repository id of the fork the branch resides in
} `json:"fork_repo" url:"fork_repo,key"`
ID string `json:"id" url:"id,key"` // unique identifier of the review app
Message *string `json:"message" url:"message,key"` // message from creating the review app if any
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // the pipeline which this review app belongs to
PrNumber *int `json:"pr_number" url:"pr_number,key"` // pull request number the review app is built for
Status string `json:"status" url:"status,key"` // current state of the review app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when review app was updated
WaitForCi bool `json:"wait_for_ci" url:"wait_for_ci,key"` // wait for ci before building the app
}
type ReviewAppCreateOpts struct {
Branch string `json:"branch" url:"branch,key"` // the branch of the repository which the review app is based on
Environment map[string]*string `json:"environment,omitempty" url:"environment,omitempty,key"` // hash of config vars
ForkRepoID *int `json:"fork_repo_id,omitempty" url:"fork_repo_id,omitempty,key"` // repository id of the fork the branch resides in
Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
PrNumber *int `json:"pr_number,omitempty" url:"pr_number,omitempty,key"` // pull request number the review app is built for
SourceBlob struct {
URL *string `json:"url,omitempty" url:"url,omitempty,key"` // URL where gzipped tar archive of source code for build was
// downloaded.
Version *string `json:"version,omitempty" url:"version,omitempty,key"` // The version number (or SHA) of the code to build.
} `json:"source_blob" url:"source_blob,key"` // The download location for the review app's source code
}
// Create a new review app
func (s *Service) ReviewAppCreate(ctx context.Context, o ReviewAppCreateOpts) (*ReviewApp, error) {
var reviewApp ReviewApp
return &reviewApp, s.Post(ctx, &reviewApp, fmt.Sprintf("/review-apps"), o)
}
// Gets an existing review app
func (s *Service) ReviewAppGetReviewApp(ctx context.Context, reviewAppID string) (*ReviewApp, error) {
var reviewApp ReviewApp
return &reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/review-apps/%v", reviewAppID), nil, nil)
}
// Delete an existing review app
func (s *Service) ReviewAppDelete(ctx context.Context, reviewAppID string) (*ReviewApp, error) {
var reviewApp ReviewApp
return &reviewApp, s.Delete(ctx, &reviewApp, fmt.Sprintf("/review-apps/%v", reviewAppID))
}
// Get a review app using the associated app_id
func (s *Service) ReviewAppGetReviewAppByAppID(ctx context.Context, appIdentity string) (*ReviewApp, error) {
var reviewApp ReviewApp
return &reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/apps/%v/review-app", appIdentity), nil, nil)
}
type ReviewAppListResult []ReviewApp
// List review apps for a pipeline
func (s *Service) ReviewAppList(ctx context.Context, pipelineID string, lr *ListRange) (ReviewAppListResult, error) {
var reviewApp ReviewAppListResult
return reviewApp, s.Get(ctx, &reviewApp, fmt.Sprintf("/pipelines/%v/review-apps", pipelineID), nil, lr)
}
// Review apps can be configured for pipelines.
type ReviewAppConfig struct {
AutomaticReviewApps bool `json:"automatic_review_apps" url:"automatic_review_apps,key"` // enable automatic review apps for pull requests
BaseName *string `json:"base_name" url:"base_name,key"` // A unique prefix that will be used to create review app names
DeployTarget *struct {
ID string `json:"id" url:"id,key"` // unique identifier of deploy target
Type string `json:"type" url:"type,key"` // type of deploy target
} `json:"deploy_target" url:"deploy_target,key"` // the deploy target for the review apps of a pipeline
DestroyStaleApps bool `json:"destroy_stale_apps" url:"destroy_stale_apps,key"` // automatically destroy review apps when they haven't been deployed for
// a number of days
PipelineID string `json:"pipeline_id" url:"pipeline_id,key"` // unique identifier of pipeline
Repo struct {
ID int `json:"id" url:"id,key"` // repository id
} `json:"repo" url:"repo,key"`
StaleDays int `json:"stale_days" url:"stale_days,key"` // number of days without a deployment after which to consider a review
// app stale
WaitForCi bool `json:"wait_for_ci" url:"wait_for_ci,key"` // If true, review apps are created only when CI passes
}
type ReviewAppConfigEnableOpts struct {
AutomaticReviewApps *bool `json:"automatic_review_apps,omitempty" url:"automatic_review_apps,omitempty,key"` // enable automatic review apps for pull requests
BaseName *string `json:"base_name,omitempty" url:"base_name,omitempty,key"` // A unique prefix that will be used to create review app names
DeployTarget *struct {
ID string `json:"id" url:"id,key"` // unique identifier of deploy target
Type string `json:"type" url:"type,key"` // type of deploy target
} `json:"deploy_target,omitempty" url:"deploy_target,omitempty,key"` // the deploy target for the review apps of a pipeline
DestroyStaleApps *bool `json:"destroy_stale_apps,omitempty" url:"destroy_stale_apps,omitempty,key"` // automatically destroy review apps when they haven't been deployed for
// a number of days
Repo string `json:"repo" url:"repo,key"` // repository name
StaleDays *int `json:"stale_days,omitempty" url:"stale_days,omitempty,key"` // number of days without a deployment after which to consider a review
// app stale
WaitForCi *bool `json:"wait_for_ci,omitempty" url:"wait_for_ci,omitempty,key"` // If true, review apps are created only when CI passes
}
// Enable review apps for a pipeline
func (s *Service) ReviewAppConfigEnable(ctx context.Context, pipelineID string, o ReviewAppConfigEnableOpts) (*ReviewAppConfig, error) {
var reviewAppConfig ReviewAppConfig
return &reviewAppConfig, s.Post(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), o)
}
// Get review apps configuration for a pipeline
func (s *Service) ReviewAppConfigInfo(ctx context.Context, pipelineID string) (*ReviewAppConfig, error) {
var reviewAppConfig ReviewAppConfig
return &reviewAppConfig, s.Get(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), nil, nil)
}
type ReviewAppConfigUpdateOpts struct {
AutomaticReviewApps *bool `json:"automatic_review_apps,omitempty" url:"automatic_review_apps,omitempty,key"` // enable automatic review apps for pull requests
BaseName *string `json:"base_name,omitempty" url:"base_name,omitempty,key"` // A unique prefix that will be used to create review app names
DeployTarget *struct {
ID string `json:"id" url:"id,key"` // unique identifier of deploy target
Type string `json:"type" url:"type,key"` // type of deploy target
} `json:"deploy_target,omitempty" url:"deploy_target,omitempty,key"` // the deploy target for the review apps of a pipeline
DestroyStaleApps *bool `json:"destroy_stale_apps,omitempty" url:"destroy_stale_apps,omitempty,key"` // automatically destroy review apps when they haven't been deployed for
// a number of days
StaleDays *int `json:"stale_days,omitempty" url:"stale_days,omitempty,key"` // number of days without a deployment after which to consider a review
// app stale
WaitForCi *bool `json:"wait_for_ci,omitempty" url:"wait_for_ci,omitempty,key"` // If true, review apps are created only when CI passes
}
// Update review app configuration for a pipeline
func (s *Service) ReviewAppConfigUpdate(ctx context.Context, pipelineID string, o ReviewAppConfigUpdateOpts) (*ReviewAppConfig, error) {
var reviewAppConfig ReviewAppConfig
return &reviewAppConfig, s.Patch(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID), o)
}
// Disable review apps for a pipeline
func (s *Service) ReviewAppConfigDelete(ctx context.Context, pipelineID string) (*ReviewAppConfig, error) {
var reviewAppConfig ReviewAppConfig
return &reviewAppConfig, s.Delete(ctx, &reviewAppConfig, fmt.Sprintf("/pipelines/%v/review-app-config", pipelineID))
}
// A slug is a snapshot of your application code that is ready to run on
// the platform.
type Slug struct {
Blob struct {
Method string `json:"method" url:"method,key"` // method to be used to interact with the slug blob
URL string `json:"url" url:"url,key"` // URL to interact with the slug blob
} `json:"blob" url:"blob,key"` // pointer to the url where clients can fetch or store the actual
// release binary
BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of slug
Checksum *string `json:"checksum" url:"checksum,key"` // an optional checksum of the slug for verifying its integrity
Commit *string `json:"commit" url:"commit,key"` // identification of the code with your version control system (eg: SHA
// of the git HEAD)
CommitDescription *string `json:"commit_description" url:"commit_description,key"` // an optional description of the provided commit
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when slug was created
ID string `json:"id" url:"id,key"` // unique identifier of slug
ProcessTypes map[string]string `json:"process_types" url:"process_types,key"` // hash mapping process type names to their respective command
Size *int `json:"size" url:"size,key"` // size of slug, in bytes
Stack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of slug stack
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when slug was updated
}
// Info for existing slug.
func (s *Service) SlugInfo(ctx context.Context, appIdentity string, slugIdentity string) (*Slug, error) {
var slug Slug
return &slug, s.Get(ctx, &slug, fmt.Sprintf("/apps/%v/slugs/%v", appIdentity, slugIdentity), nil, nil)
}
type SlugCreateOpts struct {
BuildpackProvidedDescription *string `json:"buildpack_provided_description,omitempty" url:"buildpack_provided_description,omitempty,key"` // description from buildpack of slug
Checksum *string `json:"checksum,omitempty" url:"checksum,omitempty,key"` // an optional checksum of the slug for verifying its integrity
Commit *string `json:"commit,omitempty" url:"commit,omitempty,key"` // identification of the code with your version control system (eg: SHA
// of the git HEAD)
CommitDescription *string `json:"commit_description,omitempty" url:"commit_description,omitempty,key"` // an optional description of the provided commit
ProcessTypes map[string]string `json:"process_types" url:"process_types,key"` // hash mapping process type names to their respective command
Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
}
// Create a new slug. For more information please refer to [Deploying
// Slugs using the Platform
// API](https://devcenter.heroku.com/articles/platform-api-deploying-slug
// s).
func (s *Service) SlugCreate(ctx context.Context, appIdentity string, o SlugCreateOpts) (*Slug, error) {
var slug Slug
return &slug, s.Post(ctx, &slug, fmt.Sprintf("/apps/%v/slugs", appIdentity), o)
}
// SMS numbers are used for recovery on accounts with two-factor
// authentication enabled.
type SmsNumber struct {
SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
}
// Recover an account using an SMS recovery code
func (s *Service) SmsNumberSMSNumber(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
var smsNumber SmsNumber
return &smsNumber, s.Get(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number", accountIdentity), nil, nil)
}
// Recover an account using an SMS recovery code
func (s *Service) SmsNumberRecover(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
var smsNumber SmsNumber
return &smsNumber, s.Post(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number/actions/recover", accountIdentity), nil)
}
// Confirm an SMS number change with a confirmation code
func (s *Service) SmsNumberConfirm(ctx context.Context, accountIdentity string) (*SmsNumber, error) {
var smsNumber SmsNumber
return &smsNumber, s.Post(ctx, &smsNumber, fmt.Sprintf("/users/%v/sms-number/actions/confirm", accountIdentity), nil)
}
// SNI Endpoint is a public address serving a custom SSL cert for HTTPS
// traffic, using the SNI TLS extension, to a Heroku app.
type SniEndpoint struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // application that this SSL certificate is on
CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when endpoint was created
DisplayName *string `json:"display_name" url:"display_name,key"` // unique name for SSL certificate
Domains []string `json:"domains" url:"domains,key"` // domains associated with this SSL certificate
ID string `json:"id" url:"id,key"` // unique identifier of this SNI endpoint
Name string `json:"name" url:"name,key"` // unique name for SNI endpoint
SSLCert struct {
IsCaSigned bool `json:"ca_signed?" url:"ca_signed?,key"`
CertDomains []interface{} `json:"cert_domains" url:"cert_domains,key"`
ExpiresAt time.Time `json:"expires_at" url:"expires_at,key"`
ID string `json:"id" url:"id,key"` // unique identifier of this SSL certificate
Issuer string `json:"issuer" url:"issuer,key"`
IsSelfSigned bool `json:"self_signed?" url:"self_signed?,key"`
StartsAt time.Time `json:"starts_at" url:"starts_at,key"`
Subject string `json:"subject" url:"subject,key"`
} `json:"ssl_cert" url:"ssl_cert,key"` // certificate provided by this endpoint
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when SNI endpoint was updated
}
type SniEndpointCreateOpts struct {
CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
PrivateKey string `json:"private_key" url:"private_key,key"` // contents of the private key (eg .key file)
}
// Create a new SNI endpoint.
func (s *Service) SniEndpointCreate(ctx context.Context, appIdentity string, o SniEndpointCreateOpts) (*SniEndpoint, error) {
var sniEndpoint SniEndpoint
return &sniEndpoint, s.Post(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints", appIdentity), o)
}
// Delete existing SNI endpoint.
func (s *Service) SniEndpointDelete(ctx context.Context, appIdentity string, sniEndpointIdentity string) (*SniEndpoint, error) {
var sniEndpoint SniEndpoint
return &sniEndpoint, s.Delete(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity))
}
// Info for existing SNI endpoint.
func (s *Service) SniEndpointInfo(ctx context.Context, appIdentity string, sniEndpointIdentity string) (*SniEndpoint, error) {
var sniEndpoint SniEndpoint
return &sniEndpoint, s.Get(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity), nil, nil)
}
type SniEndpointListResult []SniEndpoint
// List existing SNI endpoints.
func (s *Service) SniEndpointList(ctx context.Context, appIdentity string, lr *ListRange) (SniEndpointListResult, error) {
var sniEndpoint SniEndpointListResult
return sniEndpoint, s.Get(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints", appIdentity), nil, lr)
}
type SniEndpointUpdateOpts struct {
CertificateChain string `json:"certificate_chain" url:"certificate_chain,key"` // raw contents of the public certificate chain (eg: .crt or .pem file)
PrivateKey string `json:"private_key" url:"private_key,key"` // contents of the private key (eg .key file)
}
// Update an existing SNI endpoint.
func (s *Service) SniEndpointUpdate(ctx context.Context, appIdentity string, sniEndpointIdentity string, o SniEndpointUpdateOpts) (*SniEndpoint, error) {
var sniEndpoint SniEndpoint
return &sniEndpoint, s.Patch(ctx, &sniEndpoint, fmt.Sprintf("/apps/%v/sni-endpoints/%v", appIdentity, sniEndpointIdentity), o)
}
// A source is a location for uploading and downloading an application's
// source code.
type Source struct {
SourceBlob struct {
GetURL string `json:"get_url" url:"get_url,key"` // URL to download the source
PutURL string `json:"put_url" url:"put_url,key"` // URL to upload the source
} `json:"source_blob" url:"source_blob,key"` // pointer to the URL where clients can fetch or store the source
}
// Create URLs for uploading and downloading source.
func (s *Service) SourceCreate(ctx context.Context) (*Source, error) {
var source Source
return &source, s.Post(ctx, &source, fmt.Sprintf("/sources"), nil)
}
// Create URLs for uploading and downloading source. Deprecated in favor
// of `POST /sources`
func (s *Service) SourceCreateDeprecated(ctx context.Context, appIdentity string) (*Source, error) {
var source Source
return &source, s.Post(ctx, &source, fmt.Sprintf("/apps/%v/sources", appIdentity), nil)
}
// A space is an isolated, highly available, secure app execution
// environment.
type Space struct {
CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
// 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
// Heroku-managed peering connection that's automatically created when
// using Heroku Data add-ons. It must be between a /16 and a /20
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
Organization struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // organization that owns this space
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of space region
Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
State string `json:"state" url:"state,key"` // availability of this space
Team struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this space
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
}
type SpaceListResult []Space
// List existing spaces.
func (s *Service) SpaceList(ctx context.Context, lr *ListRange) (SpaceListResult, error) {
var space SpaceListResult
return space, s.Get(ctx, &space, fmt.Sprintf("/spaces"), nil, lr)
}
// Info for existing space.
func (s *Service) SpaceInfo(ctx context.Context, spaceIdentity string) (*Space, error) {
var space Space
return &space, s.Get(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity), nil, nil)
}
type SpaceUpdateOpts struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of space
}
// Update an existing space.
func (s *Service) SpaceUpdate(ctx context.Context, spaceIdentity string, o SpaceUpdateOpts) (*Space, error) {
var space Space
return &space, s.Patch(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity), o)
}
// Delete an existing space.
func (s *Service) SpaceDelete(ctx context.Context, spaceIdentity string) (*Space, error) {
var space Space
return &space, s.Delete(ctx, &space, fmt.Sprintf("/spaces/%v", spaceIdentity))
}
type SpaceCreateOpts struct {
CIDR *string `json:"cidr,omitempty" url:"cidr,omitempty,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
// 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
DataCIDR *string `json:"data_cidr,omitempty" url:"data_cidr,omitempty,key"` // The RFC-1918 CIDR that the Private Space will use for the
// Heroku-managed peering connection that's automatically created when
// using Heroku Data add-ons. It must be between a /16 and a /20
LogDrainURL *string `json:"log_drain_url,omitempty" url:"log_drain_url,omitempty,key"` // URL to which all apps will drain logs. Only settable during space
// creation and enables direct logging. Must use HTTPS.
Name string `json:"name" url:"name,key"` // unique name of space
Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique identifier of region
Shield *bool `json:"shield,omitempty" url:"shield,omitempty,key"` // true if this space has shield enabled
Team string `json:"team" url:"team,key"` // unique name of team
}
// Create a new space.
func (s *Service) SpaceCreate(ctx context.Context, o SpaceCreateOpts) (*Space, error) {
var space Space
return &space, s.Post(ctx, &space, fmt.Sprintf("/spaces"), o)
}
// Space access represents the permissions a particular user has on a
// particular space.
type SpaceAppAccess struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
ID string `json:"id" url:"id,key"` // unique identifier of space
Permissions []struct {
Description string `json:"description" url:"description,key"`
Name string `json:"name" url:"name,key"`
} `json:"permissions" url:"permissions,key"` // user space permissions
Space struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"space" url:"space,key"` // space user belongs to
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // identity of user account
}
// List permissions for a given user on a given space.
func (s *Service) SpaceAppAccessInfo(ctx context.Context, spaceIdentity string, accountIdentity string) (*SpaceAppAccess, error) {
var spaceAppAccess SpaceAppAccess
return &spaceAppAccess, s.Get(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members/%v", spaceIdentity, accountIdentity), nil, nil)
}
type SpaceAppAccessUpdateOpts struct {
Permissions []struct {
Name *string `json:"name,omitempty" url:"name,omitempty,key"`
} `json:"permissions" url:"permissions,key"`
}
// Update an existing user's set of permissions on a space.
func (s *Service) SpaceAppAccessUpdate(ctx context.Context, spaceIdentity string, accountIdentity string, o SpaceAppAccessUpdateOpts) (*SpaceAppAccess, error) {
var spaceAppAccess SpaceAppAccess
return &spaceAppAccess, s.Patch(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members/%v", spaceIdentity, accountIdentity), o)
}
type SpaceAppAccessListResult []SpaceAppAccess
// List all users and their permissions on a space.
func (s *Service) SpaceAppAccessList(ctx context.Context, spaceIdentity string, lr *ListRange) (SpaceAppAccessListResult, error) {
var spaceAppAccess SpaceAppAccessListResult
return spaceAppAccess, s.Get(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members", spaceIdentity), nil, lr)
}
// Network address translation (NAT) for stable outbound IP addresses
// from a space
type SpaceNAT struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when network address translation for a space was created
Sources []string `json:"sources" url:"sources,key"` // potential IPs from which outbound network traffic will originate
State string `json:"state" url:"state,key"` // availability of network address translation for a space
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when network address translation for a space was updated
}
// Current state of network address translation for a space.
func (s *Service) SpaceNATInfo(ctx context.Context, spaceIdentity string) (*SpaceNAT, error) {
var spaceNAT SpaceNAT
return &spaceNAT, s.Get(ctx, &spaceNAT, fmt.Sprintf("/spaces/%v/nat", spaceIdentity), nil, nil)
}
// Space Topology provides you with a mechanism for viewing all the
// running dynos, formations and applications for a space. This is the
// same data thats used to power our DNS Service Discovery.
type SpaceTopology struct {
Apps []struct {
Domains []interface{} `json:"domains" url:"domains,key"`
Formation []struct {
Dynos []struct {
Hostname string `json:"hostname" url:"hostname,key"` // localspace hostname of resource
ID string `json:"id" url:"id,key"` // unique identifier of this dyno
Number int `json:"number" url:"number,key"` // process number, e.g. 1 in web.1
PrivateIP string `json:"private_ip" url:"private_ip,key"` // RFC1918 Address of Dyno
} `json:"dynos" url:"dynos,key"` // Current dynos for application
ID string `json:"id" url:"id,key"` // unique identifier of this process type
ProcessType string `json:"process_type" url:"process_type,key"` // Name of process type
} `json:"formation" url:"formation,key"` // formations for application
ID string `json:"id" url:"id,key"` // unique identifier of app
} `json:"apps" url:"apps,key"` // The apps within this space
Version int `json:"version" url:"version,key"` // version of the space topology payload
}
// Current space topology
func (s *Service) SpaceTopologyTopology(ctx context.Context, spaceIdentity string) (*SpaceTopology, error) {
var spaceTopology SpaceTopology
return &spaceTopology, s.Get(ctx, &spaceTopology, fmt.Sprintf("/spaces/%v/topology", spaceIdentity), nil, nil)
}
// Transfer spaces between enterprise teams with the same Enterprise
// Account.
type SpaceTransfer struct{}
type SpaceTransferTransferOpts struct {
NewOwner string `json:"new_owner" url:"new_owner,key"` // unique name of team
}
type SpaceTransferTransferResult struct {
CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
// 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
// Heroku-managed peering connection that's automatically created when
// using Heroku Data add-ons. It must be between a /16 and a /20
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
Organization struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // organization that owns this space
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of space region
Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
State string `json:"state" url:"state,key"` // availability of this space
Team struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this space
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
}
// Transfer space between enterprise teams
func (s *Service) SpaceTransferTransfer(ctx context.Context, spaceIdentity string, o SpaceTransferTransferOpts) (*SpaceTransferTransferResult, error) {
var spaceTransfer SpaceTransferTransferResult
return &spaceTransfer, s.Post(ctx, &spaceTransfer, fmt.Sprintf("/spaces/%v/transfer", spaceIdentity), o)
}
// Stacks are the different application execution environments available
// in the Heroku platform.
type Stack struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when stack was introduced
Default bool `json:"default" url:"default,key"` // indicates this stack is the default for new apps
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
State string `json:"state" url:"state,key"` // availability of this stack: beta, deprecated or public
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when stack was last modified
}
// Stack info.
func (s *Service) StackInfo(ctx context.Context, stackIdentity string) (*Stack, error) {
var stack Stack
return &stack, s.Get(ctx, &stack, fmt.Sprintf("/stacks/%v", stackIdentity), nil, nil)
}
type StackListResult []Stack
// List available stacks.
func (s *Service) StackList(ctx context.Context, lr *ListRange) (StackListResult, error) {
var stack StackListResult
return stack, s.Get(ctx, &stack, fmt.Sprintf("/stacks"), nil, lr)
}
// Teams allow you to manage access to a shared group of applications
// and other resources.
type Team struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the team was created
CreditCardCollections bool `json:"credit_card_collections" url:"credit_card_collections,key"` // whether charges incurred by the team are paid by credit card.
Default bool `json:"default" url:"default,key"` // whether to use this team when none is specified
EnterpriseAccount *struct {
ID string `json:"id" url:"id,key"` // unique identifier of the enterprise account
Name string `json:"name" url:"name,key"` // unique name of the enterprise account
} `json:"enterprise_account" url:"enterprise_account,key"`
ID string `json:"id" url:"id,key"` // unique identifier of team
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider associated with the Team
MembershipLimit *float64 `json:"membership_limit" url:"membership_limit,key"` // upper limit of members allowed in a team.
Name string `json:"name" url:"name,key"` // unique name of team
ProvisionedLicenses bool `json:"provisioned_licenses" url:"provisioned_licenses,key"` // whether the team is provisioned licenses by salesforce.
Role *string `json:"role" url:"role,key"` // role in the team
Type string `json:"type" url:"type,key"` // type of team.
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the team was updated
}
type TeamListResult []Team
// List teams in which you are a member.
func (s *Service) TeamList(ctx context.Context, lr *ListRange) (TeamListResult, error) {
var team TeamListResult
return team, s.Get(ctx, &team, fmt.Sprintf("/teams"), nil, lr)
}
// Info for a team.
func (s *Service) TeamInfo(ctx context.Context, teamIdentity string) (*Team, error) {
var team Team
return &team, s.Get(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity), nil, nil)
}
type TeamUpdateOpts struct {
Default *bool `json:"default,omitempty" url:"default,omitempty,key"` // whether to use this team when none is specified
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of team
}
// Update team properties.
func (s *Service) TeamUpdate(ctx context.Context, teamIdentity string, o TeamUpdateOpts) (*Team, error) {
var team Team
return &team, s.Patch(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity), o)
}
type TeamCreateOpts struct {
Address1 *string `json:"address_1,omitempty" url:"address_1,omitempty,key"` // street address line 1
Address2 *string `json:"address_2,omitempty" url:"address_2,omitempty,key"` // street address line 2
CardNumber *string `json:"card_number,omitempty" url:"card_number,omitempty,key"` // encrypted card number of payment method
City *string `json:"city,omitempty" url:"city,omitempty,key"` // city
Country *string `json:"country,omitempty" url:"country,omitempty,key"` // country
Cvv *string `json:"cvv,omitempty" url:"cvv,omitempty,key"` // card verification value
DeviceData *string `json:"device_data,omitempty" url:"device_data,omitempty,key"` // Device data string generated by the client
ExpirationMonth *string `json:"expiration_month,omitempty" url:"expiration_month,omitempty,key"` // expiration month
ExpirationYear *string `json:"expiration_year,omitempty" url:"expiration_year,omitempty,key"` // expiration year
FirstName *string `json:"first_name,omitempty" url:"first_name,omitempty,key"` // the first name for payment method
LastName *string `json:"last_name,omitempty" url:"last_name,omitempty,key"` // the last name for payment method
Name string `json:"name" url:"name,key"` // unique name of team
Nonce *string `json:"nonce,omitempty" url:"nonce,omitempty,key"` // Nonce generated by Braintree hosted fields form
Other *string `json:"other,omitempty" url:"other,omitempty,key"` // metadata
PostalCode *string `json:"postal_code,omitempty" url:"postal_code,omitempty,key"` // postal code
State *string `json:"state,omitempty" url:"state,omitempty,key"` // state
}
// Create a new team.
func (s *Service) TeamCreate(ctx context.Context, o TeamCreateOpts) (*Team, error) {
var team Team
return &team, s.Post(ctx, &team, fmt.Sprintf("/teams"), o)
}
// Delete an existing team.
func (s *Service) TeamDelete(ctx context.Context, teamIdentity string) (*Team, error) {
var team Team
return &team, s.Delete(ctx, &team, fmt.Sprintf("/teams/%v", teamIdentity))
}
type TeamListByEnterpriseAccountResult []Team
// List teams for an enterprise account.
func (s *Service) TeamListByEnterpriseAccount(ctx context.Context, enterpriseAccountIdentity string, lr *ListRange) (TeamListByEnterpriseAccountResult, error) {
var team TeamListByEnterpriseAccountResult
return team, s.Get(ctx, &team, fmt.Sprintf("/enterprise-accounts/%v/teams", enterpriseAccountIdentity), nil, lr)
}
type TeamCreateInEnterpriseAccountOpts struct {
Name string `json:"name" url:"name,key"` // unique name of team
}
// Create a team in an enterprise account.
func (s *Service) TeamCreateInEnterpriseAccount(ctx context.Context, enterpriseAccountIdentity string, o TeamCreateInEnterpriseAccountOpts) (*Team, error) {
var team Team
return &team, s.Post(ctx, &team, fmt.Sprintf("/enterprise-accounts/%v/teams", enterpriseAccountIdentity), o)
}
type TeamAddOn struct{}
type TeamAddOnListForTeamResult []struct {
Actions []struct{} `json:"actions" url:"actions,key"` // provider actions for this specific add-on
AddonService struct {
ID string `json:"id" url:"id,key"` // unique identifier of this add-on-service
Name string `json:"name" url:"name,key"` // unique name of this add-on-service
} `json:"addon_service" url:"addon_service,key"` // identity of add-on service
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // billing application associated with this add-on
BilledPrice *struct {
Cents int `json:"cents" url:"cents,key"` // price in cents per unit of plan
Contract bool `json:"contract" url:"contract,key"` // price is negotiated in a contract outside of monthly add-on billing
Unit string `json:"unit" url:"unit,key"` // unit of price for plan
} `json:"billed_price" url:"billed_price,key"` // billed price
BillingEntity struct {
ID string `json:"id" url:"id,key"` // unique identifier of the billing entity
Name string `json:"name" url:"name,key"` // name of the billing entity
Type string `json:"type" url:"type,key"` // type of Object of the billing entity; new types allowed at any time.
} `json:"billing_entity" url:"billing_entity,key"` // billing entity associated with this add-on
ConfigVars []string `json:"config_vars" url:"config_vars,key"` // config vars exposed to the owning app by this add-on
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when add-on was created
ID string `json:"id" url:"id,key"` // unique identifier of add-on
Name string `json:"name" url:"name,key"` // globally unique name of the add-on
Plan struct {
ID string `json:"id" url:"id,key"` // unique identifier of this plan
Name string `json:"name" url:"name,key"` // unique name of this plan
} `json:"plan" url:"plan,key"` // identity of add-on plan
ProviderID string `json:"provider_id" url:"provider_id,key"` // id of this add-on with its provider
State string `json:"state" url:"state,key"` // state in the add-on's lifecycle
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when add-on was updated
WebURL *string `json:"web_url" url:"web_url,key"` // URL for logging into web interface of add-on (e.g. a dashboard)
}
// List add-ons used across all Team apps
func (s *Service) TeamAddOnListForTeam(ctx context.Context, teamIdentity string, lr *ListRange) (TeamAddOnListForTeamResult, error) {
var teamAddOn TeamAddOnListForTeamResult
return teamAddOn, s.Get(ctx, &teamAddOn, fmt.Sprintf("/teams/%v/addons", teamIdentity), nil, lr)
}
// A team app encapsulates the team specific functionality of Heroku
// apps.
type TeamApp struct {
ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
BuildStack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
ID string `json:"id" url:"id,key"` // unique identifier of app
InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
Name string `json:"name" url:"name,key"` // unique name of app
Owner *struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"owner" url:"owner,key"` // identity of app owner
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of app region
ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
Space *struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
} `json:"space" url:"space,key"` // identity of space
Stack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of app stack
Team *struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
}
type TeamAppCreateOpts struct {
InternalRouting *bool `json:"internal_routing,omitempty" url:"internal_routing,omitempty,key"` // describes whether a Private Spaces app is externally routable or not
Locked *bool `json:"locked,omitempty" url:"locked,omitempty,key"` // are other team members forbidden from joining this app.
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // unique name of app
Personal *bool `json:"personal,omitempty" url:"personal,omitempty,key"` // force creation of the app in the user account even if a default team
// is set.
Region *string `json:"region,omitempty" url:"region,omitempty,key"` // unique name of region
Space *string `json:"space,omitempty" url:"space,omitempty,key"` // unique name of space
Stack *string `json:"stack,omitempty" url:"stack,omitempty,key"` // unique name of stack
Team *string `json:"team,omitempty" url:"team,omitempty,key"` // unique name of team
}
// Create a new app in the specified team, in the default team if
// unspecified, or in personal account, if default team is not set.
func (s *Service) TeamAppCreate(ctx context.Context, o TeamAppCreateOpts) (*TeamApp, error) {
var teamApp TeamApp
return &teamApp, s.Post(ctx, &teamApp, fmt.Sprintf("/teams/apps"), o)
}
// Info for a team app.
func (s *Service) TeamAppInfo(ctx context.Context, teamAppIdentity string) (*TeamApp, error) {
var teamApp TeamApp
return &teamApp, s.Get(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), nil, nil)
}
type TeamAppUpdateLockedOpts struct {
Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
}
// Lock or unlock a team app.
func (s *Service) TeamAppUpdateLocked(ctx context.Context, teamAppIdentity string, o TeamAppUpdateLockedOpts) (*TeamApp, error) {
var teamApp TeamApp
return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
}
type TeamAppTransferToAccountOpts struct {
Owner string `json:"owner" url:"owner,key"` // unique email address of account
}
// Transfer an existing team app to another Heroku account.
func (s *Service) TeamAppTransferToAccount(ctx context.Context, teamAppIdentity string, o TeamAppTransferToAccountOpts) (*TeamApp, error) {
var teamApp TeamApp
return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
}
type TeamAppTransferToTeamOpts struct {
Owner string `json:"owner" url:"owner,key"` // unique name of team
}
// Transfer an existing team app to another team.
func (s *Service) TeamAppTransferToTeam(ctx context.Context, teamAppIdentity string, o TeamAppTransferToTeamOpts) (*TeamApp, error) {
var teamApp TeamApp
return &teamApp, s.Patch(ctx, &teamApp, fmt.Sprintf("/teams/apps/%v", teamAppIdentity), o)
}
type TeamAppListByTeamResult []TeamApp
// List team apps.
func (s *Service) TeamAppListByTeam(ctx context.Context, teamIdentity string, lr *ListRange) (TeamAppListByTeamResult, error) {
var teamApp TeamAppListByTeamResult
return teamApp, s.Get(ctx, &teamApp, fmt.Sprintf("/teams/%v/apps", teamIdentity), nil, lr)
}
// A team collaborator represents an account that has been given access
// to a team app on Heroku.
type TeamAppCollaborator struct {
App struct {
ID string `json:"id" url:"id,key"` // unique identifier of app
Name string `json:"name" url:"name,key"` // unique name of app
} `json:"app" url:"app,key"` // app collaborator belongs to
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when collaborator was created
ID string `json:"id" url:"id,key"` // unique identifier of collaborator
Permissions []struct {
Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
Name string `json:"name" url:"name,key"` // The name of the app permission.
} `json:"permissions" url:"permissions,key"` // array of permissions for the collaborator (only applicable if the app
// is on a team)
Role *string `json:"role" url:"role,key"` // role in the team
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when collaborator was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"user" url:"user,key"` // identity of collaborated account
}
type TeamAppCollaboratorCreateOpts struct {
Permissions []*string `json:"permissions,omitempty" url:"permissions,omitempty,key"` // An array of permissions to give to the collaborator.
Silent *bool `json:"silent,omitempty" url:"silent,omitempty,key"` // whether to suppress email invitation when creating collaborator
User string `json:"user" url:"user,key"` // unique email address of account
}
// Create a new collaborator on a team app. Use this endpoint instead of
// the `/apps/{app_id_or_name}/collaborator` endpoint when you want the
// collaborator to be granted [permissions]
// (https://devcenter.heroku.com/articles/org-users-access#roles-and-perm
// issions) according to their role in the team.
func (s *Service) TeamAppCollaboratorCreate(ctx context.Context, appIdentity string, o TeamAppCollaboratorCreateOpts) (*TeamAppCollaborator, error) {
var teamAppCollaborator TeamAppCollaborator
return &teamAppCollaborator, s.Post(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators", appIdentity), o)
}
// Delete an existing collaborator from a team app.
func (s *Service) TeamAppCollaboratorDelete(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string) (*TeamAppCollaborator, error) {
var teamAppCollaborator TeamAppCollaborator
return &teamAppCollaborator, s.Delete(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity))
}
// Info for a collaborator on a team app.
func (s *Service) TeamAppCollaboratorInfo(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string) (*TeamAppCollaborator, error) {
var teamAppCollaborator TeamAppCollaborator
return &teamAppCollaborator, s.Get(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity), nil, nil)
}
type TeamAppCollaboratorUpdateOpts struct {
Permissions []string `json:"permissions" url:"permissions,key"` // An array of permissions to give to the collaborator.
}
// Update an existing collaborator from a team app.
func (s *Service) TeamAppCollaboratorUpdate(ctx context.Context, teamAppIdentity string, teamAppCollaboratorIdentity string, o TeamAppCollaboratorUpdateOpts) (*TeamAppCollaborator, error) {
var teamAppCollaborator TeamAppCollaborator
return &teamAppCollaborator, s.Patch(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators/%v", teamAppIdentity, teamAppCollaboratorIdentity), o)
}
type TeamAppCollaboratorListResult []TeamAppCollaborator
// List collaborators on a team app.
func (s *Service) TeamAppCollaboratorList(ctx context.Context, teamAppIdentity string, lr *ListRange) (TeamAppCollaboratorListResult, error) {
var teamAppCollaborator TeamAppCollaboratorListResult
return teamAppCollaborator, s.Get(ctx, &teamAppCollaborator, fmt.Sprintf("/teams/apps/%v/collaborators", teamAppIdentity), nil, lr)
}
// A team app permission is a behavior that is assigned to a user in a
// team app.
type TeamAppPermission struct {
Description string `json:"description" url:"description,key"` // A description of what the app permission allows.
Name string `json:"name" url:"name,key"` // The name of the app permission.
}
type TeamAppPermissionListResult []TeamAppPermission
// Lists permissions available to teams.
func (s *Service) TeamAppPermissionList(ctx context.Context, lr *ListRange) (TeamAppPermissionListResult, error) {
var teamAppPermission TeamAppPermissionListResult
return teamAppPermission, s.Get(ctx, &teamAppPermission, fmt.Sprintf("/teams/permissions"), nil, lr)
}
// Usage for an enterprise team at a daily resolution.
type TeamDailyUsage struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Apps []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
AppName string `json:"app_name" url:"app_name,key"` // unique name of app
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
} `json:"apps" url:"apps,key"` // app usage in the team
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Date string `json:"date" url:"date,key"` // date of the usage
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // team identifier
Name string `json:"name" url:"name,key"` // name of the team
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
}
type TeamDailyUsageInfoOpts struct {
End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
Start string `json:"start" url:"start,key"` // range start date
}
type TeamDailyUsageInfoResult []TeamDailyUsage
// Retrieves usage for an enterprise team for a range of days. Start and
// end dates can be specified as query parameters using the date format
// YYYY-MM-DD. The team identifier can be found from the [team list
// endpoint](https://devcenter.heroku.com/articles/platform-api-reference
// #team-list).
//
func (s *Service) TeamDailyUsageInfo(ctx context.Context, teamID string, o TeamDailyUsageInfoOpts, lr *ListRange) (TeamDailyUsageInfoResult, error) {
var teamDailyUsage TeamDailyUsageInfoResult
return teamDailyUsage, s.Get(ctx, &teamDailyUsage, fmt.Sprintf("/teams/%v/usage/daily", teamID), o, lr)
}
// A team feature represents a feature enabled on a team account.
type TeamFeature struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when team feature was created
Description string `json:"description" url:"description,key"` // description of team feature
DisplayName string `json:"display_name" url:"display_name,key"` // user readable feature name
DocURL string `json:"doc_url" url:"doc_url,key"` // documentation URL of team feature
Enabled bool `json:"enabled" url:"enabled,key"` // whether or not team feature has been enabled
FeedbackEmail string `json:"feedback_email" url:"feedback_email,key"` // e-mail to send feedback about the feature
ID string `json:"id" url:"id,key"` // unique identifier of team feature
Name string `json:"name" url:"name,key"` // unique name of team feature
State string `json:"state" url:"state,key"` // state of team feature
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when team feature was updated
}
// Info for an existing team feature.
func (s *Service) TeamFeatureInfo(ctx context.Context, teamIdentity string, teamFeatureIdentity string) (*TeamFeature, error) {
var teamFeature TeamFeature
return &teamFeature, s.Get(ctx, &teamFeature, fmt.Sprintf("/teams/%v/features/%v", teamIdentity, teamFeatureIdentity), nil, nil)
}
type TeamFeatureListResult []TeamFeature
// List existing team features.
func (s *Service) TeamFeatureList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamFeatureListResult, error) {
var teamFeature TeamFeatureListResult
return teamFeature, s.Get(ctx, &teamFeature, fmt.Sprintf("/teams/%v/features", teamIdentity), nil, lr)
}
// A team invitation represents an invite to a team.
type TeamInvitation struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invitation was created
ID string `json:"id" url:"id,key"` // unique identifier of an invitation
InvitedBy struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
Name *string `json:"name" url:"name,key"` // full name of the account owner
} `json:"invited_by" url:"invited_by,key"`
Role *string `json:"role" url:"role,key"` // role in the team
Team struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"`
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invitation was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
Name *string `json:"name" url:"name,key"` // full name of the account owner
} `json:"user" url:"user,key"`
}
type TeamInvitationListResult []TeamInvitation
// Get a list of a team's Identity Providers
func (s *Service) TeamInvitationList(ctx context.Context, teamName string, lr *ListRange) (TeamInvitationListResult, error) {
var teamInvitation TeamInvitationListResult
return teamInvitation, s.Get(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations", teamName), nil, lr)
}
type TeamInvitationCreateOpts struct {
Email string `json:"email" url:"email,key"` // unique email address of account
Role *string `json:"role" url:"role,key"` // role in the team
}
// Create Team Invitation
func (s *Service) TeamInvitationCreate(ctx context.Context, teamIdentity string, o TeamInvitationCreateOpts) (*TeamInvitation, error) {
var teamInvitation TeamInvitation
return &teamInvitation, s.Put(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations", teamIdentity), o)
}
// Revoke a team invitation.
func (s *Service) TeamInvitationRevoke(ctx context.Context, teamIdentity string, teamInvitationIdentity string) (*TeamInvitation, error) {
var teamInvitation TeamInvitation
return &teamInvitation, s.Delete(ctx, &teamInvitation, fmt.Sprintf("/teams/%v/invitations/%v", teamIdentity, teamInvitationIdentity))
}
// Get an invitation by its token
func (s *Service) TeamInvitationGet(ctx context.Context, teamInvitationToken string, lr *ListRange) (*TeamInvitation, error) {
var teamInvitation TeamInvitation
return &teamInvitation, s.Get(ctx, &teamInvitation, fmt.Sprintf("/teams/invitations/%v", teamInvitationToken), nil, lr)
}
type TeamInvitationAcceptResult struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the membership record was created
Email string `json:"email" url:"email,key"` // email address of the team member
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of the team member
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // name of the identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
Role *string `json:"role" url:"role,key"` // role in the team
TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise team member has two factor authentication
// enabled
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the membership record was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
Name *string `json:"name" url:"name,key"` // full name of the account owner
} `json:"user" url:"user,key"` // user information for the membership
}
// Accept Team Invitation
func (s *Service) TeamInvitationAccept(ctx context.Context, teamInvitationToken string) (*TeamInvitationAcceptResult, error) {
var teamInvitation TeamInvitationAcceptResult
return &teamInvitation, s.Post(ctx, &teamInvitation, fmt.Sprintf("/teams/invitations/%v/accept", teamInvitationToken), nil)
}
// A Team Invoice is an itemized bill of goods for a team which includes
// pricing and charges.
type TeamInvoice struct {
AddonsTotal int `json:"addons_total" url:"addons_total,key"` // total add-ons charges in on this invoice
ChargesTotal int `json:"charges_total" url:"charges_total,key"` // total charges on this invoice
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when invoice was created
CreditsTotal int `json:"credits_total" url:"credits_total,key"` // total credits on this invoice
DatabaseTotal int `json:"database_total" url:"database_total,key"` // total database charges on this invoice
DynoUnits float64 `json:"dyno_units" url:"dyno_units,key"` // total amount of dyno units consumed across dyno types.
ID string `json:"id" url:"id,key"` // unique identifier of this invoice
Number int `json:"number" url:"number,key"` // human readable invoice number
PaymentStatus string `json:"payment_status" url:"payment_status,key"` // status of the invoice payment
PeriodEnd string `json:"period_end" url:"period_end,key"` // the ending date that the invoice covers
PeriodStart string `json:"period_start" url:"period_start,key"` // the starting date that this invoice covers
PlatformTotal int `json:"platform_total" url:"platform_total,key"` // total platform charges on this invoice
State int `json:"state" url:"state,key"` // payment status for this invoice (pending, successful, failed)
Total int `json:"total" url:"total,key"` // combined total of charges and credits on this invoice
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when invoice was updated
WeightedDynoHours float64 `json:"weighted_dyno_hours" url:"weighted_dyno_hours,key"` // The total amount of hours consumed across dyno types.
}
// Info for existing invoice.
func (s *Service) TeamInvoiceInfo(ctx context.Context, teamIdentity string, teamInvoiceIdentity int) (*TeamInvoice, error) {
var teamInvoice TeamInvoice
return &teamInvoice, s.Get(ctx, &teamInvoice, fmt.Sprintf("/teams/%v/invoices/%v", teamIdentity, teamInvoiceIdentity), nil, nil)
}
type TeamInvoiceListResult []TeamInvoice
// List existing invoices.
func (s *Service) TeamInvoiceList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamInvoiceListResult, error) {
var teamInvoice TeamInvoiceListResult
return teamInvoice, s.Get(ctx, &teamInvoice, fmt.Sprintf("/teams/%v/invoices", teamIdentity), nil, lr)
}
// A team member is an individual with access to a team.
type TeamMember struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when the membership record was created
Email string `json:"email" url:"email,key"` // email address of the team member
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of the team member
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // name of the identity provider
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
Redacted bool `json:"redacted" url:"redacted,key"` // whether the identity_provider information is redacted or not
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider information the member is federated with
Role *string `json:"role" url:"role,key"` // role in the team
TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether the Enterprise team member has two factor authentication
// enabled
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when the membership record was updated
User struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
Name *string `json:"name" url:"name,key"` // full name of the account owner
} `json:"user" url:"user,key"` // user information for the membership
}
type TeamMemberCreateOrUpdateOpts struct {
Email string `json:"email" url:"email,key"` // email address of the team member
Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
Role string `json:"role" url:"role,key"` // role in the team
}
// Create a new team member, or update their role.
func (s *Service) TeamMemberCreateOrUpdate(ctx context.Context, teamIdentity string, o TeamMemberCreateOrUpdateOpts) (*TeamMember, error) {
var teamMember TeamMember
return &teamMember, s.Put(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
}
type TeamMemberCreateOpts struct {
Email string `json:"email" url:"email,key"` // email address of the team member
Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
Role string `json:"role" url:"role,key"` // role in the team
}
// Create a new team member.
func (s *Service) TeamMemberCreate(ctx context.Context, teamIdentity string, o TeamMemberCreateOpts) (*TeamMember, error) {
var teamMember TeamMember
return &teamMember, s.Post(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
}
type TeamMemberUpdateOpts struct {
Email string `json:"email" url:"email,key"` // email address of the team member
Federated *bool `json:"federated,omitempty" url:"federated,omitempty,key"` // whether the user is federated and belongs to an Identity Provider
Role string `json:"role" url:"role,key"` // role in the team
}
// Update a team member.
func (s *Service) TeamMemberUpdate(ctx context.Context, teamIdentity string, o TeamMemberUpdateOpts) (*TeamMember, error) {
var teamMember TeamMember
return &teamMember, s.Patch(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), o)
}
// Remove a member from the team.
func (s *Service) TeamMemberDelete(ctx context.Context, teamIdentity string, teamMemberIdentity string) (*TeamMember, error) {
var teamMember TeamMember
return &teamMember, s.Delete(ctx, &teamMember, fmt.Sprintf("/teams/%v/members/%v", teamIdentity, teamMemberIdentity))
}
type TeamMemberListResult []TeamMember
// List members of the team.
func (s *Service) TeamMemberList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamMemberListResult, error) {
var teamMember TeamMemberListResult
return teamMember, s.Get(ctx, &teamMember, fmt.Sprintf("/teams/%v/members", teamIdentity), nil, lr)
}
type TeamMemberListByMemberResult []struct {
ArchivedAt *time.Time `json:"archived_at" url:"archived_at,key"` // when app was archived
BuildStack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"build_stack" url:"build_stack,key"` // identity of the stack that will be used for new builds
BuildpackProvidedDescription *string `json:"buildpack_provided_description" url:"buildpack_provided_description,key"` // description from buildpack of app
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when app was created
GitURL string `json:"git_url" url:"git_url,key"` // git repo URL of app
ID string `json:"id" url:"id,key"` // unique identifier of app
InternalRouting *bool `json:"internal_routing" url:"internal_routing,key"` // describes whether a Private Spaces app is externally routable or not
Joined bool `json:"joined" url:"joined,key"` // is the current member a collaborator on this app.
Locked bool `json:"locked" url:"locked,key"` // are other team members forbidden from joining this app.
Maintenance bool `json:"maintenance" url:"maintenance,key"` // maintenance status of app
Name string `json:"name" url:"name,key"` // unique name of app
Owner *struct {
Email string `json:"email" url:"email,key"` // unique email address of account
ID string `json:"id" url:"id,key"` // unique identifier of an account
} `json:"owner" url:"owner,key"` // identity of app owner
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of app region
ReleasedAt *time.Time `json:"released_at" url:"released_at,key"` // when app was released
RepoSize *int `json:"repo_size" url:"repo_size,key"` // git repo size in bytes of app
SlugSize *int `json:"slug_size" url:"slug_size,key"` // slug size in bytes of app
Space *struct {
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
} `json:"space" url:"space,key"` // identity of space
Stack struct {
ID string `json:"id" url:"id,key"` // unique identifier of stack
Name string `json:"name" url:"name,key"` // unique name of stack
} `json:"stack" url:"stack,key"` // identity of app stack
Team *struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this app
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when app was updated
WebURL string `json:"web_url" url:"web_url,key"` // web URL of app
}
// List the apps of a team member.
func (s *Service) TeamMemberListByMember(ctx context.Context, teamIdentity string, teamMemberIdentity string, lr *ListRange) (TeamMemberListByMemberResult, error) {
var teamMember TeamMemberListByMemberResult
return teamMember, s.Get(ctx, &teamMember, fmt.Sprintf("/teams/%v/members/%v/apps", teamIdentity, teamMemberIdentity), nil, lr)
}
// Usage for an enterprise team at a monthly resolution.
type TeamMonthlyUsage struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
Apps []struct {
Addons float64 `json:"addons" url:"addons,key"` // total add-on credits used
AppName string `json:"app_name" url:"app_name,key"` // unique name of app
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
} `json:"apps" url:"apps,key"` // app usage in the team
Connect float64 `json:"connect" url:"connect,key"` // average connect rows synced
Data float64 `json:"data" url:"data,key"` // total add-on credits used for first party add-ons
Dynos float64 `json:"dynos" url:"dynos,key"` // dynos used
ID string `json:"id" url:"id,key"` // team identifier
Month string `json:"month" url:"month,key"` // year and month of the usage
Name string `json:"name" url:"name,key"` // name of the team
Partner float64 `json:"partner" url:"partner,key"` // total add-on credits used for third party add-ons
Space float64 `json:"space" url:"space,key"` // space credits used
}
type TeamMonthlyUsageInfoOpts struct {
End *string `json:"end,omitempty" url:"end,omitempty,key"` // range end date
Start string `json:"start" url:"start,key"` // range start date
}
type TeamMonthlyUsageInfoResult []TeamMonthlyUsage
// Retrieves usage for an enterprise team for a range of months. Start
// and end dates can be specified as query parameters using the date,
// YYYY-MM. If no end date is specified, one month of usage is returned.
// The team identifier can be found from the [team list
// endpoint](https://devcenter.heroku.com/articles/platform-api-reference
// #team-list).
//
func (s *Service) TeamMonthlyUsageInfo(ctx context.Context, teamID string, o TeamMonthlyUsageInfoOpts, lr *ListRange) (TeamMonthlyUsageInfoResult, error) {
var teamMonthlyUsage TeamMonthlyUsageInfoResult
return teamMonthlyUsage, s.Get(ctx, &teamMonthlyUsage, fmt.Sprintf("/teams/%v/usage/monthly", teamID), o, lr)
}
// Tracks a Team's Preferences
type TeamPreferences struct {
AddonsControls *bool `json:"addons-controls" url:"addons-controls,key"` // Whether add-on service rules should be applied to add-on
// installations
DefaultPermission *string `json:"default-permission" url:"default-permission,key"` // The default permission used when adding new members to the team
}
// Retrieve Team Preferences
func (s *Service) TeamPreferencesList(ctx context.Context, teamPreferencesIdentity string) (*TeamPreferences, error) {
var teamPreferences TeamPreferences
return &teamPreferences, s.Get(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), nil, nil)
}
type TeamPreferencesUpdateOpts struct {
AddonsControls *bool `json:"addons-controls,omitempty" url:"addons-controls,omitempty,key"` // Whether add-on service rules should be applied to add-on
// installations
}
// Update Team Preferences
func (s *Service) TeamPreferencesUpdate(ctx context.Context, teamPreferencesIdentity string, o TeamPreferencesUpdateOpts) (*TeamPreferences, error) {
var teamPreferences TeamPreferences
return &teamPreferences, s.Patch(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), o)
}
// A space is an isolated, highly available, secure app execution
// environment.
type TeamSpace struct{}
type TeamSpaceListResult []struct {
CIDR string `json:"cidr" url:"cidr,key"` // The RFC-1918 CIDR the Private Space will use. It must be a /16 in
// 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when space was created
DataCIDR string `json:"data_cidr" url:"data_cidr,key"` // The RFC-1918 CIDR that the Private Space will use for the
// Heroku-managed peering connection that's automatically created when
// using Heroku Data add-ons. It must be between a /16 and a /20
ID string `json:"id" url:"id,key"` // unique identifier of space
Name string `json:"name" url:"name,key"` // unique name of space
Organization struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // organization that owns this space
Region struct {
ID string `json:"id" url:"id,key"` // unique identifier of region
Name string `json:"name" url:"name,key"` // unique name of region
} `json:"region" url:"region,key"` // identity of space region
Shield bool `json:"shield" url:"shield,key"` // true if this space has shield enabled
State string `json:"state" url:"state,key"` // availability of this space
Team struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"` // team that owns this space
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when space was updated
}
// List spaces owned by the team
func (s *Service) TeamSpaceList(ctx context.Context, teamIdentity string, lr *ListRange) (TeamSpaceListResult, error) {
var teamSpace TeamSpaceListResult
return teamSpace, s.Get(ctx, &teamSpace, fmt.Sprintf("/teams/%v/spaces", teamIdentity), nil, lr)
}
// A single test case belonging to a test run
type TestCase struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test case was created
Description string `json:"description" url:"description,key"` // description of the test case
Diagnostic string `json:"diagnostic" url:"diagnostic,key"` // meta information about the test case
Directive string `json:"directive" url:"directive,key"` // special note about the test case e.g. skipped, todo
ID string `json:"id" url:"id,key"` // unique identifier of a test case
Number int `json:"number" url:"number,key"` // the test number
Passed bool `json:"passed" url:"passed,key"` // whether the test case was successful
TestNode struct {
ID string `json:"id" url:"id,key"` // unique identifier of a test node
} `json:"test_node" url:"test_node,key"` // the test node which executed this test case
TestRun struct {
ID string `json:"id" url:"id,key"` // unique identifier of a test run
} `json:"test_run" url:"test_run,key"` // the test run which owns this test case
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test case was updated
}
type TestCaseListResult []TestCase
// List test cases
func (s *Service) TestCaseList(ctx context.Context, testRunID string, lr *ListRange) error {
return s.Get(ctx, nil, fmt.Sprintf("/test-runs/%v/test-cases", testRunID), nil, lr)
}
// A single test node belonging to a test run
type TestNode struct {
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test node was created
Dyno *struct {
AttachURL *string `json:"attach_url" url:"attach_url,key"` // a URL to stream output from for debug runs or null for non-debug runs
ID string `json:"id" url:"id,key"` // unique identifier of this dyno
} `json:"dyno" url:"dyno,key"` // the dyno which belongs to this test node
ErrorStatus *string `json:"error_status" url:"error_status,key"` // the status of the test run when the error occured
ExitCode *int `json:"exit_code" url:"exit_code,key"` // the exit code of the test script
ID string `json:"id" url:"id,key"` // unique identifier of a test node
Index int `json:"index" url:"index,key"` // The index of the test node
Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
OutputStreamURL string `json:"output_stream_url" url:"output_stream_url,key"` // the streaming output for the test node
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // the pipeline which owns this test node
SetupStreamURL string `json:"setup_stream_url" url:"setup_stream_url,key"` // the streaming test setup output for the test node
Status string `json:"status" url:"status,key"` // current state of the test run
TestRun struct {
ID string `json:"id" url:"id,key"` // unique identifier of a test run
} `json:"test_run" url:"test_run,key"` // the test run which owns this test node
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test node was updated
}
type TestNodeListResult []TestNode
// List test nodes
func (s *Service) TestNodeList(ctx context.Context, testRunIdentity string, lr *ListRange) error {
return s.Get(ctx, nil, fmt.Sprintf("/test-runs/%v/test-nodes", testRunIdentity), nil, lr)
}
// An execution or trial of one or more tests
type TestRun struct {
ActorEmail string `json:"actor_email" url:"actor_email,key"` // the email of the actor triggering the test run
AppSetup *struct{} `json:"app_setup" url:"app_setup,key"` // the app setup for the test run
ClearCache *bool `json:"clear_cache" url:"clear_cache,key"` // whether the test was run with an empty cache
CommitBranch string `json:"commit_branch" url:"commit_branch,key"` // the branch of the repository that the test run concerns
CommitMessage string `json:"commit_message" url:"commit_message,key"` // the message for the commit under test
CommitSha string `json:"commit_sha" url:"commit_sha,key"` // the SHA hash of the commit under test
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when test run was created
Debug bool `json:"debug" url:"debug,key"` // whether the test run was started for interactive debugging
Dyno *struct {
Size string `json:"size" url:"size,key"` // dyno size (default: "standard-1X")
} `json:"dyno" url:"dyno,key"` // the type of dynos used for this test-run
ID string `json:"id" url:"id,key"` // unique identifier of a test run
Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
Number int `json:"number" url:"number,key"` // the auto incrementing test run number
Organization *struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"` // the team that owns this test-run
Pipeline struct {
ID string `json:"id" url:"id,key"` // unique identifier of pipeline
} `json:"pipeline" url:"pipeline,key"` // the pipeline which owns this test-run
SourceBlobURL string `json:"source_blob_url" url:"source_blob_url,key"` // The download location for the source code to be tested
Status string `json:"status" url:"status,key"` // current state of the test run
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when test-run was updated
User struct {
AllowTracking bool `json:"allow_tracking" url:"allow_tracking,key"` // whether to allow third party web activity tracking
Beta bool `json:"beta" url:"beta,key"` // whether allowed to utilize beta Heroku features
CountryOfResidence *string `json:"country_of_residence" url:"country_of_residence,key"` // country where account owner resides
CreatedAt time.Time `json:"created_at" url:"created_at,key"` // when account was created
DefaultOrganization *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"default_organization" url:"default_organization,key"` // team selected by default
DefaultTeam *struct {
ID string `json:"id" url:"id,key"` // unique identifier of team
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"default_team" url:"default_team,key"` // team selected by default
DelinquentAt *time.Time `json:"delinquent_at" url:"delinquent_at,key"` // when account became delinquent
Email string `json:"email" url:"email,key"` // unique email address of account
Federated bool `json:"federated" url:"federated,key"` // whether the user is federated and belongs to an Identity Provider
ID string `json:"id" url:"id,key"` // unique identifier of an account
IdentityProvider *struct {
ID string `json:"id" url:"id,key"` // unique identifier of this identity provider
Name string `json:"name" url:"name,key"` // user-friendly unique identifier for this identity provider
Organization struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"organization" url:"organization,key"`
Owner struct {
ID string `json:"id" url:"id,key"` // unique identifier of the owner
Name string `json:"name" url:"name,key"` // name of the owner
Type string `json:"type" url:"type,key"` // type of the owner
} `json:"owner" url:"owner,key"` // entity that owns this identity provider
Team struct {
Name string `json:"name" url:"name,key"` // unique name of team
} `json:"team" url:"team,key"`
} `json:"identity_provider" url:"identity_provider,key"` // Identity Provider details for federated users.
LastLogin *time.Time `json:"last_login" url:"last_login,key"` // when account last authorized with Heroku
Name *string `json:"name" url:"name,key"` // full name of the account owner
SmsNumber *string `json:"sms_number" url:"sms_number,key"` // SMS number of account
SuspendedAt *time.Time `json:"suspended_at" url:"suspended_at,key"` // when account was suspended
TwoFactorAuthentication bool `json:"two_factor_authentication" url:"two_factor_authentication,key"` // whether two-factor auth is enabled on the account
UpdatedAt time.Time `json:"updated_at" url:"updated_at,key"` // when account was updated
Verified bool `json:"verified" url:"verified,key"` // whether account has been verified with billing information
} `json:"user" url:"user,key"` // An account represents an individual signed up to use the Heroku
// platform.
WarningMessage *string `json:"warning_message" url:"warning_message,key"` // human friently warning emitted during the test run
}
type TestRunCreateOpts struct {
CommitBranch string `json:"commit_branch" url:"commit_branch,key"` // the branch of the repository that the test run concerns
CommitMessage string `json:"commit_message" url:"commit_message,key"` // the message for the commit under test
CommitSha string `json:"commit_sha" url:"commit_sha,key"` // the SHA hash of the commit under test
Debug *bool `json:"debug,omitempty" url:"debug,omitempty,key"` // whether the test run was started for interactive debugging
Organization *string `json:"organization,omitempty" url:"organization,omitempty,key"` // unique name of team
Pipeline string `json:"pipeline" url:"pipeline,key"` // unique identifier of pipeline
SourceBlobURL string `json:"source_blob_url" url:"source_blob_url,key"` // The download location for the source code to be tested
}
// Create a new test-run.
func (s *Service) TestRunCreate(ctx context.Context, o TestRunCreateOpts) (*TestRun, error) {
var testRun TestRun
return &testRun, s.Post(ctx, &testRun, fmt.Sprintf("/test-runs"), o)
}
// Info for existing test-run.
func (s *Service) TestRunInfo(ctx context.Context, testRunID string) (*TestRun, error) {
var testRun TestRun
return &testRun, s.Get(ctx, &testRun, fmt.Sprintf("/test-runs/%v", testRunID), nil, nil)
}
type TestRunListResult []TestRun
// List existing test-runs for a pipeline.
func (s *Service) TestRunList(ctx context.Context, pipelineID string, lr *ListRange) error {
return s.Get(ctx, nil, fmt.Sprintf("/pipelines/%v/test-runs", pipelineID), nil, lr)
}
// Info for existing test-run by Pipeline
func (s *Service) TestRunInfoByPipeline(ctx context.Context, pipelineID string, testRunNumber int) (*TestRun, error) {
var testRun TestRun
return &testRun, s.Get(ctx, &testRun, fmt.Sprintf("/pipelines/%v/test-runs/%v", pipelineID, testRunNumber), nil, nil)
}
type TestRunUpdateOpts struct {
Message *string `json:"message" url:"message,key"` // human friendly message indicating reason for an error
Status string `json:"status" url:"status,key"` // current state of the test run
}
// Update a test-run's status.
func (s *Service) TestRunUpdate(ctx context.Context, testRunNumber int, o TestRunUpdateOpts) (*TestRun, error) {
var testRun TestRun
return &testRun, s.Patch(ctx, &testRun, fmt.Sprintf("/test-runs/%v", testRunNumber), o)
}
// Tracks a user's preferences and message dismissals
type UserPreferences struct {
DefaultOrganization *string `json:"default-organization" url:"default-organization,key"` // User's default team
DismissedGettingStarted *bool `json:"dismissed-getting-started" url:"dismissed-getting-started,key"` // Whether the user has dismissed the getting started banner
DismissedGithubBanner *bool `json:"dismissed-github-banner" url:"dismissed-github-banner,key"` // Whether the user has dismissed the GitHub link banner
DismissedOrgAccessControls *bool `json:"dismissed-org-access-controls" url:"dismissed-org-access-controls,key"` // Whether the user has dismissed the Organization Access Controls
// banner
DismissedOrgWizardNotification *bool `json:"dismissed-org-wizard-notification" url:"dismissed-org-wizard-notification,key"` // Whether the user has dismissed the Organization Wizard
DismissedPipelinesBanner *bool `json:"dismissed-pipelines-banner" url:"dismissed-pipelines-banner,key"` // Whether the user has dismissed the Pipelines banner
DismissedPipelinesGithubBanner *bool `json:"dismissed-pipelines-github-banner" url:"dismissed-pipelines-github-banner,key"` // Whether the user has dismissed the GitHub banner on a pipeline
// overview
DismissedPipelinesGithubBanners []string `json:"dismissed-pipelines-github-banners" url:"dismissed-pipelines-github-banners,key"` // Which pipeline uuids the user has dismissed the GitHub banner for
DismissedSmsBanner *bool `json:"dismissed-sms-banner" url:"dismissed-sms-banner,key"` // Whether the user has dismissed the 2FA SMS banner
Timezone *string `json:"timezone" url:"timezone,key"` // User's default timezone
}
// Retrieve User Preferences
func (s *Service) UserPreferencesList(ctx context.Context, userPreferencesIdentity string) (*UserPreferences, error) {
var userPreferences UserPreferences
return &userPreferences, s.Get(ctx, &userPreferences, fmt.Sprintf("/users/%v/preferences", userPreferencesIdentity), nil, nil)
}
type UserPreferencesUpdateOpts struct {
DefaultOrganization *string `json:"default-organization,omitempty" url:"default-organization,omitempty,key"` // User's default team
DismissedGettingStarted *bool `json:"dismissed-getting-started,omitempty" url:"dismissed-getting-started,omitempty,key"` // Whether the user has dismissed the getting started banner
DismissedGithubBanner *bool `json:"dismissed-github-banner,omitempty" url:"dismissed-github-banner,omitempty,key"` // Whether the user has dismissed the GitHub link banner
DismissedOrgAccessControls *bool `json:"dismissed-org-access-controls,omitempty" url:"dismissed-org-access-controls,omitempty,key"` // Whether the user has dismissed the Organization Access Controls
// banner
DismissedOrgWizardNotification *bool `json:"dismissed-org-wizard-notification,omitempty" url:"dismissed-org-wizard-notification,omitempty,key"` // Whether the user has dismissed the Organization Wizard
DismissedPipelinesBanner *bool `json:"dismissed-pipelines-banner,omitempty" url:"dismissed-pipelines-banner,omitempty,key"` // Whether the user has dismissed the Pipelines banner
DismissedPipelinesGithubBanner *bool `json:"dismissed-pipelines-github-banner,omitempty" url:"dismissed-pipelines-github-banner,omitempty,key"` // Whether the user has dismissed the GitHub banner on a pipeline
// overview
DismissedPipelinesGithubBanners []*string `json:"dismissed-pipelines-github-banners,omitempty" url:"dismissed-pipelines-github-banners,omitempty,key"` // Which pipeline uuids the user has dismissed the GitHub banner for
DismissedSmsBanner *bool `json:"dismissed-sms-banner,omitempty" url:"dismissed-sms-banner,omitempty,key"` // Whether the user has dismissed the 2FA SMS banner
Timezone *string `json:"timezone,omitempty" url:"timezone,omitempty,key"` // User's default timezone
}
// Update User Preferences
func (s *Service) UserPreferencesUpdate(ctx context.Context, userPreferencesIdentity string, o UserPreferencesUpdateOpts) (*UserPreferences, error) {
var userPreferences UserPreferences
return &userPreferences, s.Patch(ctx, &userPreferences, fmt.Sprintf("/users/%v/preferences", userPreferencesIdentity), o)
}
// [VPN](https://devcenter.heroku.com/articles/private-space-vpn-connecti
// on) provides a way to connect your Private Spaces to your network via
// VPN.
type VPNConnection struct {
ID string `json:"id" url:"id,key"` // VPN ID
IKEVersion int `json:"ike_version" url:"ike_version,key"` // IKE Version
Name string `json:"name" url:"name,key"` // VPN Name
PublicIP string `json:"public_ip" url:"public_ip,key"` // Public IP of VPN customer gateway
RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
SpaceCIDRBlock string `json:"space_cidr_block" url:"space_cidr_block,key"` // CIDR Block of the Private Space
Status string `json:"status" url:"status,key"` // Status of the VPN
StatusMessage string `json:"status_message" url:"status_message,key"` // Details of the status
Tunnels []struct {
CustomerIP string `json:"customer_ip" url:"customer_ip,key"` // Public IP address for the customer side of the tunnel
IP string `json:"ip" url:"ip,key"` // Public IP address for the tunnel
LastStatusChange string `json:"last_status_change" url:"last_status_change,key"` // Timestamp of last status changed
PreSharedKey string `json:"pre_shared_key" url:"pre_shared_key,key"` // Pre-shared key
Status string `json:"status" url:"status,key"` // Status of the tunnel
StatusMessage string `json:"status_message" url:"status_message,key"` // Details of the status
} `json:"tunnels" url:"tunnels,key"`
}
type VPNConnectionCreateOpts struct {
Name string `json:"name" url:"name,key"` // VPN Name
PublicIP string `json:"public_ip" url:"public_ip,key"` // Public IP of VPN customer gateway
RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
}
// Create a new VPN connection in a private space.
func (s *Service) VPNConnectionCreate(ctx context.Context, spaceIdentity string, o VPNConnectionCreateOpts) (*VPNConnection, error) {
var vpnConnection VPNConnection
return &vpnConnection, s.Post(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections", spaceIdentity), o)
}
// Destroy existing VPN Connection
func (s *Service) VPNConnectionDestroy(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string) (*VPNConnection, error) {
var vpnConnection VPNConnection
return &vpnConnection, s.Delete(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity))
}
type VPNConnectionListResult []VPNConnection
// List VPN connections for a space.
func (s *Service) VPNConnectionList(ctx context.Context, spaceIdentity string, lr *ListRange) (VPNConnectionListResult, error) {
var vpnConnection VPNConnectionListResult
return vpnConnection, s.Get(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections", spaceIdentity), nil, lr)
}
// Info for an existing vpn-connection.
func (s *Service) VPNConnectionInfo(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string) (*VPNConnection, error) {
var vpnConnection VPNConnection
return &vpnConnection, s.Get(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity), nil, nil)
}
type VPNConnectionUpdateOpts struct {
RoutableCidrs []string `json:"routable_cidrs" url:"routable_cidrs,key"` // Routable CIDRs of VPN
}
// Update a VPN connection in a private space.
func (s *Service) VPNConnectionUpdate(ctx context.Context, spaceIdentity string, vpnConnectionIdentity string, o VPNConnectionUpdateOpts) (*VPNConnection, error) {
var vpnConnection VPNConnection
return &vpnConnection, s.Patch(ctx, &vpnConnection, fmt.Sprintf("/spaces/%v/vpn-connections/%v", spaceIdentity, vpnConnectionIdentity), o)
}
|