|
27 | 27 | PoolStatus,
|
28 | 28 | PoolVolumeType,
|
29 | 29 | Runtime,
|
| 30 | + ACLRule, |
| 31 | + ACLRuleRequest, |
| 32 | + AddClusterACLRulesRequest, |
| 33 | + AddClusterACLRulesResponse, |
30 | 34 | Cluster,
|
31 | 35 | ClusterType,
|
32 | 36 | CreateClusterRequest,
|
|
38 | 42 | CreatePoolRequestUpgradePolicy,
|
39 | 43 | ExternalNode,
|
40 | 44 | ExternalNodeAuth,
|
| 45 | + ListClusterACLRulesResponse, |
41 | 46 | ListClusterAvailableTypesResponse,
|
42 | 47 | ListClusterAvailableVersionsResponse,
|
43 | 48 | ListClusterTypesResponse,
|
|
48 | 53 | Node,
|
49 | 54 | NodeMetadata,
|
50 | 55 | Pool,
|
| 56 | + SetClusterACLRulesRequest, |
| 57 | + SetClusterACLRulesResponse, |
51 | 58 | SetClusterTypeRequest,
|
52 | 59 | UpdateClusterRequest,
|
53 | 60 | UpdateClusterRequestAutoUpgrade,
|
|
69 | 76 | unmarshal_Version,
|
70 | 77 | unmarshal_Cluster,
|
71 | 78 | unmarshal_Node,
|
| 79 | + unmarshal_AddClusterACLRulesResponse, |
72 | 80 | unmarshal_ExternalNode,
|
73 | 81 | unmarshal_ExternalNodeAuth,
|
| 82 | + unmarshal_ListClusterACLRulesResponse, |
74 | 83 | unmarshal_ListClusterAvailableTypesResponse,
|
75 | 84 | unmarshal_ListClusterAvailableVersionsResponse,
|
76 | 85 | unmarshal_ListClusterTypesResponse,
|
|
79 | 88 | unmarshal_ListPoolsResponse,
|
80 | 89 | unmarshal_ListVersionsResponse,
|
81 | 90 | unmarshal_NodeMetadata,
|
| 91 | + unmarshal_SetClusterACLRulesResponse, |
| 92 | + marshal_AddClusterACLRulesRequest, |
82 | 93 | marshal_CreateClusterRequest,
|
83 | 94 | marshal_CreatePoolRequest,
|
| 95 | + marshal_SetClusterACLRulesRequest, |
84 | 96 | marshal_SetClusterTypeRequest,
|
85 | 97 | marshal_UpdateClusterRequest,
|
86 | 98 | marshal_UpdatePoolRequest,
|
@@ -749,6 +761,204 @@ async def migrate_cluster_to_sbscsi(
|
749 | 761 | self._throw_on_error(res)
|
750 | 762 | return unmarshal_Cluster(res.json())
|
751 | 763 |
|
| 764 | + async def list_cluster_acl_rules( |
| 765 | + self, |
| 766 | + *, |
| 767 | + cluster_id: str, |
| 768 | + region: Optional[Region] = None, |
| 769 | + page: Optional[int] = None, |
| 770 | + page_size: Optional[int] = None, |
| 771 | + ) -> ListClusterACLRulesResponse: |
| 772 | + """ |
| 773 | + List ACLs. |
| 774 | + List ACLs for a specific cluster. |
| 775 | + :param cluster_id: ID of the cluster whose ACLs will be listed. |
| 776 | + :param region: Region to target. If none is passed will use default region from the config. |
| 777 | + :param page: Page number for the returned ACLs. |
| 778 | + :param page_size: Maximum number of ACLs per page. |
| 779 | + :return: :class:`ListClusterACLRulesResponse <ListClusterACLRulesResponse>` |
| 780 | +
|
| 781 | + Usage: |
| 782 | + :: |
| 783 | +
|
| 784 | + result = await api.list_cluster_acl_rules( |
| 785 | + cluster_id="example", |
| 786 | + ) |
| 787 | + """ |
| 788 | + |
| 789 | + param_region = validate_path_param( |
| 790 | + "region", region or self.client.default_region |
| 791 | + ) |
| 792 | + param_cluster_id = validate_path_param("cluster_id", cluster_id) |
| 793 | + |
| 794 | + res = self._request( |
| 795 | + "GET", |
| 796 | + f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/acls", |
| 797 | + params={ |
| 798 | + "page": page, |
| 799 | + "page_size": page_size or self.client.default_page_size, |
| 800 | + }, |
| 801 | + ) |
| 802 | + |
| 803 | + self._throw_on_error(res) |
| 804 | + return unmarshal_ListClusterACLRulesResponse(res.json()) |
| 805 | + |
| 806 | + async def list_cluster_acl_rules_all( |
| 807 | + self, |
| 808 | + *, |
| 809 | + cluster_id: str, |
| 810 | + region: Optional[Region] = None, |
| 811 | + page: Optional[int] = None, |
| 812 | + page_size: Optional[int] = None, |
| 813 | + ) -> List[ACLRule]: |
| 814 | + """ |
| 815 | + List ACLs. |
| 816 | + List ACLs for a specific cluster. |
| 817 | + :param cluster_id: ID of the cluster whose ACLs will be listed. |
| 818 | + :param region: Region to target. If none is passed will use default region from the config. |
| 819 | + :param page: Page number for the returned ACLs. |
| 820 | + :param page_size: Maximum number of ACLs per page. |
| 821 | + :return: :class:`List[ACLRule] <List[ACLRule]>` |
| 822 | +
|
| 823 | + Usage: |
| 824 | + :: |
| 825 | +
|
| 826 | + result = await api.list_cluster_acl_rules_all( |
| 827 | + cluster_id="example", |
| 828 | + ) |
| 829 | + """ |
| 830 | + |
| 831 | + return await fetch_all_pages_async( |
| 832 | + type=ListClusterACLRulesResponse, |
| 833 | + key="rules", |
| 834 | + fetcher=self.list_cluster_acl_rules, |
| 835 | + args={ |
| 836 | + "cluster_id": cluster_id, |
| 837 | + "region": region, |
| 838 | + "page": page, |
| 839 | + "page_size": page_size, |
| 840 | + }, |
| 841 | + ) |
| 842 | + |
| 843 | + async def add_cluster_acl_rules( |
| 844 | + self, |
| 845 | + *, |
| 846 | + cluster_id: str, |
| 847 | + region: Optional[Region] = None, |
| 848 | + acls: Optional[List[ACLRuleRequest]] = None, |
| 849 | + ) -> AddClusterACLRulesResponse: |
| 850 | + """ |
| 851 | + Add new ACLs. |
| 852 | + Add new ACL rules for a specific cluster. |
| 853 | + :param cluster_id: ID of the cluster whose ACLs will be added. |
| 854 | + :param region: Region to target. If none is passed will use default region from the config. |
| 855 | + :param acls: ACLs to add. |
| 856 | + :return: :class:`AddClusterACLRulesResponse <AddClusterACLRulesResponse>` |
| 857 | +
|
| 858 | + Usage: |
| 859 | + :: |
| 860 | +
|
| 861 | + result = await api.add_cluster_acl_rules( |
| 862 | + cluster_id="example", |
| 863 | + ) |
| 864 | + """ |
| 865 | + |
| 866 | + param_region = validate_path_param( |
| 867 | + "region", region or self.client.default_region |
| 868 | + ) |
| 869 | + param_cluster_id = validate_path_param("cluster_id", cluster_id) |
| 870 | + |
| 871 | + res = self._request( |
| 872 | + "POST", |
| 873 | + f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/acls", |
| 874 | + body=marshal_AddClusterACLRulesRequest( |
| 875 | + AddClusterACLRulesRequest( |
| 876 | + cluster_id=cluster_id, |
| 877 | + region=region, |
| 878 | + acls=acls, |
| 879 | + ), |
| 880 | + self.client, |
| 881 | + ), |
| 882 | + ) |
| 883 | + |
| 884 | + self._throw_on_error(res) |
| 885 | + return unmarshal_AddClusterACLRulesResponse(res.json()) |
| 886 | + |
| 887 | + async def set_cluster_acl_rules( |
| 888 | + self, |
| 889 | + *, |
| 890 | + cluster_id: str, |
| 891 | + region: Optional[Region] = None, |
| 892 | + acls: Optional[List[ACLRuleRequest]] = None, |
| 893 | + ) -> SetClusterACLRulesResponse: |
| 894 | + """ |
| 895 | + Set new ACLs. |
| 896 | + Set new ACL rules for a specific cluster. |
| 897 | + :param cluster_id: ID of the cluster whose ACLs will be set. |
| 898 | + :param region: Region to target. If none is passed will use default region from the config. |
| 899 | + :param acls: ACLs to set. |
| 900 | + :return: :class:`SetClusterACLRulesResponse <SetClusterACLRulesResponse>` |
| 901 | +
|
| 902 | + Usage: |
| 903 | + :: |
| 904 | +
|
| 905 | + result = await api.set_cluster_acl_rules( |
| 906 | + cluster_id="example", |
| 907 | + ) |
| 908 | + """ |
| 909 | + |
| 910 | + param_region = validate_path_param( |
| 911 | + "region", region or self.client.default_region |
| 912 | + ) |
| 913 | + param_cluster_id = validate_path_param("cluster_id", cluster_id) |
| 914 | + |
| 915 | + res = self._request( |
| 916 | + "PUT", |
| 917 | + f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/acls", |
| 918 | + body=marshal_SetClusterACLRulesRequest( |
| 919 | + SetClusterACLRulesRequest( |
| 920 | + cluster_id=cluster_id, |
| 921 | + region=region, |
| 922 | + acls=acls, |
| 923 | + ), |
| 924 | + self.client, |
| 925 | + ), |
| 926 | + ) |
| 927 | + |
| 928 | + self._throw_on_error(res) |
| 929 | + return unmarshal_SetClusterACLRulesResponse(res.json()) |
| 930 | + |
| 931 | + async def delete_acl_rule( |
| 932 | + self, |
| 933 | + *, |
| 934 | + acl_id: str, |
| 935 | + region: Optional[Region] = None, |
| 936 | + ) -> None: |
| 937 | + """ |
| 938 | + Delete an existing ACL. |
| 939 | + :param acl_id: ID of the ACL rule to delete. |
| 940 | + :param region: Region to target. If none is passed will use default region from the config. |
| 941 | +
|
| 942 | + Usage: |
| 943 | + :: |
| 944 | +
|
| 945 | + result = await api.delete_acl_rule( |
| 946 | + acl_id="example", |
| 947 | + ) |
| 948 | + """ |
| 949 | + |
| 950 | + param_region = validate_path_param( |
| 951 | + "region", region or self.client.default_region |
| 952 | + ) |
| 953 | + param_acl_id = validate_path_param("acl_id", acl_id) |
| 954 | + |
| 955 | + res = self._request( |
| 956 | + "DELETE", |
| 957 | + f"/k8s/v1/regions/{param_region}/acls/{param_acl_id}", |
| 958 | + ) |
| 959 | + |
| 960 | + self._throw_on_error(res) |
| 961 | + |
752 | 962 | async def list_pools(
|
753 | 963 | self,
|
754 | 964 | *,
|
|
0 commit comments