|
20 | 20 | ListDataSourcesRequestOrderBy, |
21 | 21 | ListGrafanaUsersRequestOrderBy, |
22 | 22 | ListPlansRequestOrderBy, |
| 23 | + ListProductsRequestOrderBy, |
23 | 24 | ListTokensRequestOrderBy, |
24 | 25 | PlanName, |
25 | 26 | TokenScope, |
|
44 | 45 | ListGrafanaProductDashboardsResponse, |
45 | 46 | ListGrafanaUsersResponse, |
46 | 47 | ListPlansResponse, |
| 48 | + ListProductsResponse, |
47 | 49 | ListTokensResponse, |
48 | 50 | Plan, |
| 51 | + Product, |
49 | 52 | RegionalApiCreateContactPointRequest, |
50 | 53 | RegionalApiCreateDataSourceRequest, |
51 | 54 | RegionalApiCreateTokenRequest, |
|
79 | 82 | unmarshal_ListGrafanaProductDashboardsResponse, |
80 | 83 | unmarshal_ListGrafanaUsersResponse, |
81 | 84 | unmarshal_ListPlansResponse, |
| 85 | + unmarshal_ListProductsResponse, |
82 | 86 | unmarshal_ListTokensResponse, |
83 | 87 | unmarshal_UsageOverview, |
84 | 88 | marshal_GlobalApiCreateGrafanaUserRequest, |
@@ -1126,6 +1130,79 @@ async def delete_token( |
1126 | 1130 |
|
1127 | 1131 | self._throw_on_error(res) |
1128 | 1132 |
|
| 1133 | + async def list_products( |
| 1134 | + self, |
| 1135 | + *, |
| 1136 | + region: Optional[ScwRegion] = None, |
| 1137 | + page: Optional[int] = None, |
| 1138 | + page_size: Optional[int] = None, |
| 1139 | + order_by: Optional[ListProductsRequestOrderBy] = None, |
| 1140 | + ) -> ListProductsResponse: |
| 1141 | + """ |
| 1142 | + List all Scaleway products that send metrics and/or logs to Cockpit. |
| 1143 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1144 | + :param page: Page number to return from the paginated results. |
| 1145 | + :param page_size: Number of products to return per page. |
| 1146 | + :param order_by: Sort order for products in the response. |
| 1147 | + :return: :class:`ListProductsResponse <ListProductsResponse>` |
| 1148 | +
|
| 1149 | + Usage: |
| 1150 | + :: |
| 1151 | +
|
| 1152 | + result = await api.list_products() |
| 1153 | + """ |
| 1154 | + |
| 1155 | + param_region = validate_path_param( |
| 1156 | + "region", region or self.client.default_region |
| 1157 | + ) |
| 1158 | + |
| 1159 | + res = self._request( |
| 1160 | + "GET", |
| 1161 | + f"/cockpit/v1/regions/{param_region}/products", |
| 1162 | + params={ |
| 1163 | + "order_by": order_by, |
| 1164 | + "page": page, |
| 1165 | + "page_size": page_size or self.client.default_page_size, |
| 1166 | + }, |
| 1167 | + ) |
| 1168 | + |
| 1169 | + self._throw_on_error(res) |
| 1170 | + return unmarshal_ListProductsResponse(res.json()) |
| 1171 | + |
| 1172 | + async def list_products_all( |
| 1173 | + self, |
| 1174 | + *, |
| 1175 | + region: Optional[ScwRegion] = None, |
| 1176 | + page: Optional[int] = None, |
| 1177 | + page_size: Optional[int] = None, |
| 1178 | + order_by: Optional[ListProductsRequestOrderBy] = None, |
| 1179 | + ) -> list[Product]: |
| 1180 | + """ |
| 1181 | + List all Scaleway products that send metrics and/or logs to Cockpit. |
| 1182 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1183 | + :param page: Page number to return from the paginated results. |
| 1184 | + :param page_size: Number of products to return per page. |
| 1185 | + :param order_by: Sort order for products in the response. |
| 1186 | + :return: :class:`list[Product] <list[Product]>` |
| 1187 | +
|
| 1188 | + Usage: |
| 1189 | + :: |
| 1190 | +
|
| 1191 | + result = await api.list_products_all() |
| 1192 | + """ |
| 1193 | + |
| 1194 | + return await fetch_all_pages_async( |
| 1195 | + type=ListProductsResponse, |
| 1196 | + key="products_list", |
| 1197 | + fetcher=self.list_products, |
| 1198 | + args={ |
| 1199 | + "region": region, |
| 1200 | + "page": page, |
| 1201 | + "page_size": page_size, |
| 1202 | + "order_by": order_by, |
| 1203 | + }, |
| 1204 | + ) |
| 1205 | + |
1129 | 1206 | async def get_alert_manager( |
1130 | 1207 | self, |
1131 | 1208 | *, |
|
0 commit comments