|
20 | 20 | runner_create_runner_token_params, |
21 | 21 | runner_search_repositories_params, |
22 | 22 | runner_list_scm_organizations_params, |
| 23 | + runner_check_repository_access_params, |
23 | 24 | runner_check_authentication_for_host_params, |
24 | 25 | ) |
25 | 26 | from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given |
|
62 | 63 | from ...types.runner_create_runner_token_response import RunnerCreateRunnerTokenResponse |
63 | 64 | from ...types.runner_search_repositories_response import RunnerSearchRepositoriesResponse |
64 | 65 | from ...types.runner_list_scm_organizations_response import RunnerListScmOrganizationsResponse |
| 66 | +from ...types.runner_check_repository_access_response import RunnerCheckRepositoryAccessResponse |
65 | 67 | from ...types.runner_check_authentication_for_host_response import RunnerCheckAuthenticationForHostResponse |
66 | 68 |
|
67 | 69 | __all__ = ["RunnersResource", "AsyncRunnersResource"] |
@@ -510,6 +512,70 @@ def check_authentication_for_host( |
510 | 512 | cast_to=RunnerCheckAuthenticationForHostResponse, |
511 | 513 | ) |
512 | 514 |
|
| 515 | + def check_repository_access( |
| 516 | + self, |
| 517 | + *, |
| 518 | + repository_url: str | Omit = omit, |
| 519 | + runner_id: str | Omit = omit, |
| 520 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 521 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 522 | + extra_headers: Headers | None = None, |
| 523 | + extra_query: Query | None = None, |
| 524 | + extra_body: Body | None = None, |
| 525 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 526 | + ) -> RunnerCheckRepositoryAccessResponse: |
| 527 | + """ |
| 528 | + Checks if a principal has read access to a repository. |
| 529 | +
|
| 530 | + Use this method to: |
| 531 | +
|
| 532 | + - Validate repository access before workflow execution |
| 533 | + - Verify executor credentials for automation bindings |
| 534 | +
|
| 535 | + Returns: |
| 536 | +
|
| 537 | + - has_access: true if the principal can read the repository |
| 538 | + - FAILED_PRECONDITION if authentication is required |
| 539 | + - INVALID_ARGUMENT if the repository URL is invalid |
| 540 | +
|
| 541 | + ### Examples |
| 542 | +
|
| 543 | + - Check access: |
| 544 | +
|
| 545 | + Verifies read access to a repository. |
| 546 | +
|
| 547 | + ```yaml |
| 548 | + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" |
| 549 | + repositoryUrl: "https://github.com/org/repo" |
| 550 | + ``` |
| 551 | +
|
| 552 | + Args: |
| 553 | + repository_url: repository_url is the URL of the repository to check access for. Can be a clone |
| 554 | + URL (https://github.com/org/repo.git) or web URL (https://github.com/org/repo). |
| 555 | +
|
| 556 | + extra_headers: Send extra headers |
| 557 | +
|
| 558 | + extra_query: Add additional query parameters to the request |
| 559 | +
|
| 560 | + extra_body: Add additional JSON properties to the request |
| 561 | +
|
| 562 | + timeout: Override the client-level default timeout for this request, in seconds |
| 563 | + """ |
| 564 | + return self._post( |
| 565 | + "/gitpod.v1.RunnerService/CheckRepositoryAccess", |
| 566 | + body=maybe_transform( |
| 567 | + { |
| 568 | + "repository_url": repository_url, |
| 569 | + "runner_id": runner_id, |
| 570 | + }, |
| 571 | + runner_check_repository_access_params.RunnerCheckRepositoryAccessParams, |
| 572 | + ), |
| 573 | + options=make_request_options( |
| 574 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 575 | + ), |
| 576 | + cast_to=RunnerCheckRepositoryAccessResponse, |
| 577 | + ) |
| 578 | + |
513 | 579 | def create_logs_token( |
514 | 580 | self, |
515 | 581 | *, |
@@ -1273,6 +1339,70 @@ async def check_authentication_for_host( |
1273 | 1339 | cast_to=RunnerCheckAuthenticationForHostResponse, |
1274 | 1340 | ) |
1275 | 1341 |
|
| 1342 | + async def check_repository_access( |
| 1343 | + self, |
| 1344 | + *, |
| 1345 | + repository_url: str | Omit = omit, |
| 1346 | + runner_id: str | Omit = omit, |
| 1347 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 1348 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 1349 | + extra_headers: Headers | None = None, |
| 1350 | + extra_query: Query | None = None, |
| 1351 | + extra_body: Body | None = None, |
| 1352 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 1353 | + ) -> RunnerCheckRepositoryAccessResponse: |
| 1354 | + """ |
| 1355 | + Checks if a principal has read access to a repository. |
| 1356 | +
|
| 1357 | + Use this method to: |
| 1358 | +
|
| 1359 | + - Validate repository access before workflow execution |
| 1360 | + - Verify executor credentials for automation bindings |
| 1361 | +
|
| 1362 | + Returns: |
| 1363 | +
|
| 1364 | + - has_access: true if the principal can read the repository |
| 1365 | + - FAILED_PRECONDITION if authentication is required |
| 1366 | + - INVALID_ARGUMENT if the repository URL is invalid |
| 1367 | +
|
| 1368 | + ### Examples |
| 1369 | +
|
| 1370 | + - Check access: |
| 1371 | +
|
| 1372 | + Verifies read access to a repository. |
| 1373 | +
|
| 1374 | + ```yaml |
| 1375 | + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" |
| 1376 | + repositoryUrl: "https://github.com/org/repo" |
| 1377 | + ``` |
| 1378 | +
|
| 1379 | + Args: |
| 1380 | + repository_url: repository_url is the URL of the repository to check access for. Can be a clone |
| 1381 | + URL (https://github.com/org/repo.git) or web URL (https://github.com/org/repo). |
| 1382 | +
|
| 1383 | + extra_headers: Send extra headers |
| 1384 | +
|
| 1385 | + extra_query: Add additional query parameters to the request |
| 1386 | +
|
| 1387 | + extra_body: Add additional JSON properties to the request |
| 1388 | +
|
| 1389 | + timeout: Override the client-level default timeout for this request, in seconds |
| 1390 | + """ |
| 1391 | + return await self._post( |
| 1392 | + "/gitpod.v1.RunnerService/CheckRepositoryAccess", |
| 1393 | + body=await async_maybe_transform( |
| 1394 | + { |
| 1395 | + "repository_url": repository_url, |
| 1396 | + "runner_id": runner_id, |
| 1397 | + }, |
| 1398 | + runner_check_repository_access_params.RunnerCheckRepositoryAccessParams, |
| 1399 | + ), |
| 1400 | + options=make_request_options( |
| 1401 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 1402 | + ), |
| 1403 | + cast_to=RunnerCheckRepositoryAccessResponse, |
| 1404 | + ) |
| 1405 | + |
1276 | 1406 | async def create_logs_token( |
1277 | 1407 | self, |
1278 | 1408 | *, |
@@ -1617,6 +1747,9 @@ def __init__(self, runners: RunnersResource) -> None: |
1617 | 1747 | self.check_authentication_for_host = to_raw_response_wrapper( |
1618 | 1748 | runners.check_authentication_for_host, |
1619 | 1749 | ) |
| 1750 | + self.check_repository_access = to_raw_response_wrapper( |
| 1751 | + runners.check_repository_access, |
| 1752 | + ) |
1620 | 1753 | self.create_logs_token = to_raw_response_wrapper( |
1621 | 1754 | runners.create_logs_token, |
1622 | 1755 | ) |
@@ -1664,6 +1797,9 @@ def __init__(self, runners: AsyncRunnersResource) -> None: |
1664 | 1797 | self.check_authentication_for_host = async_to_raw_response_wrapper( |
1665 | 1798 | runners.check_authentication_for_host, |
1666 | 1799 | ) |
| 1800 | + self.check_repository_access = async_to_raw_response_wrapper( |
| 1801 | + runners.check_repository_access, |
| 1802 | + ) |
1667 | 1803 | self.create_logs_token = async_to_raw_response_wrapper( |
1668 | 1804 | runners.create_logs_token, |
1669 | 1805 | ) |
@@ -1711,6 +1847,9 @@ def __init__(self, runners: RunnersResource) -> None: |
1711 | 1847 | self.check_authentication_for_host = to_streamed_response_wrapper( |
1712 | 1848 | runners.check_authentication_for_host, |
1713 | 1849 | ) |
| 1850 | + self.check_repository_access = to_streamed_response_wrapper( |
| 1851 | + runners.check_repository_access, |
| 1852 | + ) |
1714 | 1853 | self.create_logs_token = to_streamed_response_wrapper( |
1715 | 1854 | runners.create_logs_token, |
1716 | 1855 | ) |
@@ -1758,6 +1897,9 @@ def __init__(self, runners: AsyncRunnersResource) -> None: |
1758 | 1897 | self.check_authentication_for_host = async_to_streamed_response_wrapper( |
1759 | 1898 | runners.check_authentication_for_host, |
1760 | 1899 | ) |
| 1900 | + self.check_repository_access = async_to_streamed_response_wrapper( |
| 1901 | + runners.check_repository_access, |
| 1902 | + ) |
1761 | 1903 | self.create_logs_token = async_to_streamed_response_wrapper( |
1762 | 1904 | runners.create_logs_token, |
1763 | 1905 | ) |
|
0 commit comments