Skip to content

Commit 5a396ed

Browse files
Merge pull request #294 from yamanahlawat/features/main
feat: added runpod command to create container registry auth and rena…
2 parents bd68176 + a615482 commit 5a396ed

14 files changed

Lines changed: 461 additions & 283 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
""" Example of creating a container registry auth with the Runpod API. """
2+
3+
import runpod
4+
5+
# Set your global API key with `runpod config` or uncomment the line below:
6+
# runpod.api_key = "YOUR_RUNPOD_API_KEY"
7+
8+
try:
9+
new_container_registry_auth = runpod.create_container_registry_auth(
10+
name="test-container-registry-auth-name",
11+
username="test-username",
12+
password="test-password",
13+
)
14+
15+
print(new_container_registry_auth)
16+
17+
except runpod.error.QueryError as err:
18+
print(err)
19+
print(err.query)

runpod/__init__.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,41 @@
44
import logging
55

66
from . import serverless
7-
from .serverless.modules.rp_logger import RunPodLogger
8-
from .endpoint import Endpoint
9-
from .endpoint import AsyncioEndpoint, AsyncioJob
10-
from .version import __version__
117
from .api.ctl_commands import (
12-
get_user, update_user_settings,
13-
get_gpu, get_gpus,
14-
get_pod, get_pods, create_pod, stop_pod, resume_pod, terminate_pod,
8+
create_container_registry_auth,
9+
create_endpoint,
10+
create_pod,
1511
create_template,
16-
get_endpoints, create_endpoint, update_endpoint_template
12+
get_endpoints,
13+
get_gpu,
14+
get_gpus,
15+
get_pod,
16+
get_pods,
17+
get_user,
18+
resume_pod,
19+
stop_pod,
20+
terminate_pod,
21+
update_endpoint_template,
22+
update_user_settings,
1723
)
18-
from .cli.groups.config.functions import set_credentials, check_credentials, get_credentials
19-
24+
from .cli.groups.config.functions import (
25+
check_credentials,
26+
get_credentials,
27+
set_credentials,
28+
)
29+
from .endpoint import AsyncioEndpoint, AsyncioJob, Endpoint
30+
from .serverless.modules.rp_logger import RunPodLogger
31+
from .version import __version__
2032

2133
# ------------------------------- Config Paths ------------------------------- #
22-
SSH_KEY_PATH = os.path.expanduser('~/.runpod/ssh')
34+
SSH_KEY_PATH = os.path.expanduser("~/.runpod/ssh")
2335

2436

2537
profile = "default" # pylint: disable=invalid-name
2638

2739
_credentials = get_credentials(profile)
2840
if _credentials is not None:
29-
api_key = _credentials['api_key'] # pylint: disable=invalid-name
41+
api_key = _credentials["api_key"] # pylint: disable=invalid-name
3042
else:
3143
api_key = None # pylint: disable=invalid-name
3244

0 commit comments

Comments
 (0)