|
9 | 9 | from .mutations import user as user_mutations |
10 | 10 | from .queries import gpus |
11 | 11 | from .queries import pods as pod_queries |
| 12 | +from .queries import endpoints as endpoint_queries |
12 | 13 | from .graphql import run_graphql_query |
13 | 14 | from .mutations import pods as pod_mutations |
14 | 15 | from .mutations import endpoints as endpoint_mutations |
@@ -228,6 +229,14 @@ def create_template( |
228 | 229 |
|
229 | 230 | return raw_response["data"]["saveTemplate"] |
230 | 231 |
|
| 232 | +def get_endpoints() -> dict: |
| 233 | + ''' |
| 234 | + Get all endpoints |
| 235 | + ''' |
| 236 | + raw_return = run_graphql_query(endpoint_queries.QUERY_ENDPOINT) |
| 237 | + cleaned_return = raw_return["data"]["myself"]["endpoints"] |
| 238 | + return cleaned_return |
| 239 | + |
231 | 240 | def create_endpoint( |
232 | 241 | name:str, template_id:str, gpu_ids:str="AMPERE_16", |
233 | 242 | network_volume_id:str=None, locations:str=None, |
@@ -262,3 +271,25 @@ def create_endpoint( |
262 | 271 | ) |
263 | 272 |
|
264 | 273 | return raw_response["data"]["saveEndpoint"] |
| 274 | + |
| 275 | + |
| 276 | +def update_endpoint_template( |
| 277 | + endpoint_id:str, template_id:str |
| 278 | +): |
| 279 | + ''' |
| 280 | + Update an endpoint template |
| 281 | +
|
| 282 | + :param endpoint_id: the id of the endpoint |
| 283 | + :param template_id: the id of the template to use for the endpoint |
| 284 | +
|
| 285 | + :example: |
| 286 | +
|
| 287 | + >>> endpoint_id = runpod.update_endpoint_template("test", "template_id") |
| 288 | + ''' |
| 289 | + raw_response = run_graphql_query( |
| 290 | + endpoint_mutations.update_endpoint_template_mutation( |
| 291 | + endpoint_id, template_id |
| 292 | + ) |
| 293 | + ) |
| 294 | + |
| 295 | + return raw_response["data"]["updateEndpointTemplate"] |
0 commit comments