-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from cudoventures/manual-key
Manual key
- Loading branch information
Showing
3 changed files
with
98 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from cudo_compute import cudo_api | ||
from cudo_compute.rest import ApiException | ||
import json | ||
|
||
# In normal use the api key is automatically taken from cudoctl commandline tool, | ||
# advanced users may want to supply and api key without installing cudoctl. | ||
# Below is an example of how to do that: | ||
|
||
# Create your apis first | ||
# When supplying your api key the vms api should only be created once per key. | ||
api_key = "<KEY>" | ||
vms_api = cudo_api.virtual_machines(api_key) | ||
projects_api = cudo_api.projects(api_key) | ||
|
||
# Remember to manually supply your project and not to get project id from the cudo_api | ||
project_id = '<your-project-id>' | ||
try: | ||
vms = vms_api.list_vms(project_id) | ||
print(json.dumps(vms.to_dict(), indent=2)) | ||
except ApiException as e: | ||
print(e) | ||
|
||
try: | ||
projects = projects_api.list_projects() | ||
except ApiException as e: | ||
print(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | |
|
||
[project] | ||
name = "cudo-compute" | ||
version = "0.3.3" | ||
version = "0.3.4" | ||
authors = [ | ||
{ name = "Cudo Ventures", email = "[email protected]" }, | ||
] | ||
|