2626 SDKBenchmarkCreateParams ,
2727 SDKBlueprintCreateParams ,
2828 SDKDiskSnapshotListParams ,
29+ SDKGatewayConfigListParams ,
2930 SDKNetworkPolicyListParams ,
31+ SDKGatewayConfigCreateParams ,
3032 SDKNetworkPolicyCreateParams ,
3133 SDKDevboxCreateFromImageParams ,
3234)
4143from .async_benchmark import AsyncBenchmark
4244from .async_blueprint import AsyncBlueprint
4345from ..lib .context_loader import TarFilter , build_directory_tar
46+ from .async_gateway_config import AsyncGatewayConfig
4447from .async_network_policy import AsyncNetworkPolicy
4548from .async_storage_object import AsyncStorageObject
4649from .async_scenario_builder import AsyncScenarioBuilder
@@ -924,6 +927,90 @@ async def list(self, **params: Unpack[SDKNetworkPolicyListParams]) -> list[Async
924927 return [AsyncNetworkPolicy (self ._client , item .id ) for item in page .network_policies ]
925928
926929
930+ class AsyncGatewayConfigOps :
931+ """High-level async manager for creating and managing gateway configurations.
932+
933+ Accessed via ``runloop.gateway_config`` from :class:`AsyncRunloopSDK`, provides
934+ coroutines to create, retrieve, update, delete, and list gateway configs. Gateway configs
935+ define how to proxy API requests through the credential gateway, enabling secure API
936+ proxying without exposing API keys.
937+
938+ Example:
939+ >>> runloop = AsyncRunloopSDK()
940+ >>> gateway_config = await runloop.gateway_config.create(
941+ ... name="my-api-gateway",
942+ ... endpoint="https://api.example.com",
943+ ... auth_mechanism={"type": "bearer"},
944+ ... )
945+ >>> # Use with a devbox
946+ >>> devbox = await runloop.devbox.create(
947+ ... name="my-devbox",
948+ ... gateways={
949+ ... "MY_API": {
950+ ... "gateway": gateway_config.id,
951+ ... "secret": "my-api-key-secret",
952+ ... },
953+ ... },
954+ ... )
955+ """
956+
957+ def __init__ (self , client : AsyncRunloop ) -> None :
958+ """Initialize AsyncGatewayConfigOps.
959+
960+ :param client: AsyncRunloop client instance
961+ :type client: AsyncRunloop
962+ """
963+ self ._client = client
964+
965+ async def create (self , ** params : Unpack [SDKGatewayConfigCreateParams ]) -> AsyncGatewayConfig :
966+ """Create a new gateway config.
967+
968+ Example:
969+ >>> gateway_config = await runloop.gateway_config.create(
970+ ... name="my-gateway",
971+ ... endpoint="https://api.example.com",
972+ ... auth_mechanism={"type": "header", "key": "x-api-key"},
973+ ... description="Gateway for My API",
974+ ... )
975+
976+ :param params: See :typeddict:`~runloop_api_client.sdk._types.SDKGatewayConfigCreateParams` for available parameters
977+ :return: The newly created gateway config
978+ :rtype: AsyncGatewayConfig
979+ """
980+ response = await self ._client .gateway_configs .create (** params )
981+ return AsyncGatewayConfig (self ._client , response .id )
982+
983+ def from_id (self , gateway_config_id : str ) -> AsyncGatewayConfig :
984+ """Get an AsyncGatewayConfig instance for an existing gateway config ID.
985+
986+ Example:
987+ >>> gateway_config = runloop.gateway_config.from_id("gwc_1234567890")
988+ >>> info = await gateway_config.get_info()
989+ >>> print(f"Gateway Config name: {info.name}")
990+
991+ :param gateway_config_id: ID of the gateway config
992+ :type gateway_config_id: str
993+ :return: AsyncGatewayConfig instance for the given ID
994+ :rtype: AsyncGatewayConfig
995+ """
996+ return AsyncGatewayConfig (self ._client , gateway_config_id )
997+
998+ async def list (self , ** params : Unpack [SDKGatewayConfigListParams ]) -> list [AsyncGatewayConfig ]:
999+ """List all gateway configs, optionally filtered by parameters.
1000+
1001+ Example:
1002+ >>> configs = await runloop.gateway_config.list(limit=10)
1003+ >>> for config in configs:
1004+ ... print(config.id)
1005+
1006+ :param params: See :typeddict:`~runloop_api_client.sdk._types.SDKGatewayConfigListParams` for available parameters
1007+ :return: List of gateway configs
1008+ :rtype: list[AsyncGatewayConfig]
1009+ """
1010+ page = await self ._client .gateway_configs .list (** params )
1011+ return [AsyncGatewayConfig (self ._client , item .id ) for item in page .gateway_configs ]
1012+
1013+
9271014class AsyncRunloopSDK :
9281015 """High-level asynchronous entry point for the Runloop SDK.
9291016
@@ -951,6 +1038,8 @@ class AsyncRunloopSDK:
9511038 :vartype storage_object: AsyncStorageObjectOps
9521039 :ivar network_policy: High-level async interface for network policy management
9531040 :vartype network_policy: AsyncNetworkPolicyOps
1041+ :ivar gateway_config: High-level async interface for gateway config management
1042+ :vartype gateway_config: AsyncGatewayConfigOps
9541043
9551044 Example:
9561045 >>> runloop = AsyncRunloopSDK() # Uses RUNLOOP_API_KEY env var
@@ -965,6 +1054,7 @@ class AsyncRunloopSDK:
9651054 benchmark : AsyncBenchmarkOps
9661055 devbox : AsyncDevboxOps
9671056 blueprint : AsyncBlueprintOps
1057+ gateway_config : AsyncGatewayConfigOps
9681058 network_policy : AsyncNetworkPolicyOps
9691059 scenario : AsyncScenarioOps
9701060 scorer : AsyncScorerOps
@@ -1013,6 +1103,7 @@ def __init__(
10131103 self .benchmark = AsyncBenchmarkOps (self .api )
10141104 self .devbox = AsyncDevboxOps (self .api )
10151105 self .blueprint = AsyncBlueprintOps (self .api )
1106+ self .gateway_config = AsyncGatewayConfigOps (self .api )
10161107 self .network_policy = AsyncNetworkPolicyOps (self .api )
10171108 self .scenario = AsyncScenarioOps (self .api )
10181109 self .scorer = AsyncScorerOps (self .api )
0 commit comments