kc-sdk-python 3.0.0__tar.gz → 3.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kc_sdk_python-3.0.0/kc_sdk_python.egg-info → kc_sdk_python-3.1.0}/PKG-INFO +9 -1
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/README.md +8 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/kc_api.py +37 -11
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0/kc_sdk_python.egg-info}/PKG-INFO +9 -1
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/pyproject.toml +1 -1
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/LICENSE +0 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/kc_sdk_python.egg-info/SOURCES.txt +0 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/kc_sdk_python.egg-info/dependency_links.txt +0 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/kc_sdk_python.egg-info/requires.txt +0 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/kc_sdk_python.egg-info/top_level.txt +0 -0
- {kc_sdk_python-3.0.0 → kc_sdk_python-3.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kc-sdk-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: Kvindo Cloud Python SDK — typed client for managing Kvindo Cloud infrastructure (VMs, S3, Kubernetes, load balancers, VPCs, PostgreSQL) via the REST API
|
|
5
5
|
Author: Kvindo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -45,6 +45,10 @@ balancers, VPCs, VPNs, and managed PostgreSQL.
|
|
|
45
45
|
A thin, typed client over the REST API: one resource client per resource type, all sharing the
|
|
46
46
|
same create / read / update / delete / list contract.
|
|
47
47
|
|
|
48
|
+
> **Using Claude Code?** This repo ships a [Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)
|
|
49
|
+
> that teaches Claude how to script Kvindo Cloud with this SDK — clone this repo (or otherwise have
|
|
50
|
+
> it on disk) and open Claude Code there to pick it up automatically.
|
|
51
|
+
|
|
48
52
|
## Install
|
|
49
53
|
|
|
50
54
|
```sh
|
|
@@ -59,6 +63,9 @@ Dependencies: `requests`, `marshmallow-dataclass`, `py-ulid`.
|
|
|
59
63
|
from kc_api import KcClient
|
|
60
64
|
|
|
61
65
|
client = KcClient("YOUR_API_TOKEN") # api_url defaults to https://cloud-api.kvindo.ru
|
|
66
|
+
# TLS certificate verification is on by default (verify_ssl=True). Pass
|
|
67
|
+
# verify_ssl=False only to point this SDK at a genuinely self-hosted instance
|
|
68
|
+
# with a self-signed cert.
|
|
62
69
|
|
|
63
70
|
# List (label-filtered, paginated)
|
|
64
71
|
resp = client.vms.get_by_labels({"env": "prod"}, max_page_size=50)
|
|
@@ -101,6 +108,7 @@ Part of the Kvindo Cloud developer toolchain:
|
|
|
101
108
|
- **[kc CLI](https://github.com/Kvindo/kc-cli)** — kubectl-style command-line client for Kvindo Cloud.
|
|
102
109
|
- **[terraform-provider-kvindo](https://github.com/Kvindo/terraform-provider-kvindo)** — Terraform provider ([Registry](https://registry.terraform.io/providers/kvindo/kvindo/latest)).
|
|
103
110
|
- **[Kvindo Cloud console](https://cloud.kvindo.com)** — web UI and API.
|
|
111
|
+
- **[Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)** — lets Claude script Kvindo Cloud with this SDK conversationally.
|
|
104
112
|
|
|
105
113
|
## License
|
|
106
114
|
|
|
@@ -11,6 +11,10 @@ balancers, VPCs, VPNs, and managed PostgreSQL.
|
|
|
11
11
|
A thin, typed client over the REST API: one resource client per resource type, all sharing the
|
|
12
12
|
same create / read / update / delete / list contract.
|
|
13
13
|
|
|
14
|
+
> **Using Claude Code?** This repo ships a [Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)
|
|
15
|
+
> that teaches Claude how to script Kvindo Cloud with this SDK — clone this repo (or otherwise have
|
|
16
|
+
> it on disk) and open Claude Code there to pick it up automatically.
|
|
17
|
+
|
|
14
18
|
## Install
|
|
15
19
|
|
|
16
20
|
```sh
|
|
@@ -25,6 +29,9 @@ Dependencies: `requests`, `marshmallow-dataclass`, `py-ulid`.
|
|
|
25
29
|
from kc_api import KcClient
|
|
26
30
|
|
|
27
31
|
client = KcClient("YOUR_API_TOKEN") # api_url defaults to https://cloud-api.kvindo.ru
|
|
32
|
+
# TLS certificate verification is on by default (verify_ssl=True). Pass
|
|
33
|
+
# verify_ssl=False only to point this SDK at a genuinely self-hosted instance
|
|
34
|
+
# with a self-signed cert.
|
|
28
35
|
|
|
29
36
|
# List (label-filtered, paginated)
|
|
30
37
|
resp = client.vms.get_by_labels({"env": "prod"}, max_page_size=50)
|
|
@@ -67,6 +74,7 @@ Part of the Kvindo Cloud developer toolchain:
|
|
|
67
74
|
- **[kc CLI](https://github.com/Kvindo/kc-cli)** — kubectl-style command-line client for Kvindo Cloud.
|
|
68
75
|
- **[terraform-provider-kvindo](https://github.com/Kvindo/terraform-provider-kvindo)** — Terraform provider ([Registry](https://registry.terraform.io/providers/kvindo/kvindo/latest)).
|
|
69
76
|
- **[Kvindo Cloud console](https://cloud.kvindo.com)** — web UI and API.
|
|
77
|
+
- **[Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)** — lets Claude script Kvindo Cloud with this SDK conversationally.
|
|
70
78
|
|
|
71
79
|
## License
|
|
72
80
|
|
|
@@ -46,7 +46,7 @@ logger = logging.getLogger(__name__)
|
|
|
46
46
|
# requests, marshmallow-dataclass and py-ulid.
|
|
47
47
|
def create_http_client_with_retries(
|
|
48
48
|
retry_statuses=[500, 502, 503, 504, 520, 521],
|
|
49
|
-
verify_ssl: bool =
|
|
49
|
+
verify_ssl: bool = True,
|
|
50
50
|
) -> requests.Session:
|
|
51
51
|
"""Build a `requests.Session` that retries idempotent failures with backoff.
|
|
52
52
|
|
|
@@ -55,8 +55,10 @@ def create_http_client_with_retries(
|
|
|
55
55
|
server-side; 520 = web server returned an unknown error;
|
|
56
56
|
521 = origin down (Cloudflare-specific).
|
|
57
57
|
verify_ssl: enable/disable TLS certificate verification. Defaults to
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
True — every real Kvindo Cloud API host (dev and public prod) has
|
|
59
|
+
a valid, publicly-trusted certificate. Pass False only to point
|
|
60
|
+
this SDK at a genuinely self-hosted instance with a self-signed
|
|
61
|
+
cert.
|
|
60
62
|
|
|
61
63
|
Returns:
|
|
62
64
|
A configured `requests.Session` (reuse it for connection pooling).
|
|
@@ -304,6 +306,7 @@ class KcResourceClient:
|
|
|
304
306
|
token: str,
|
|
305
307
|
api_url: str = "https://cloud-api.kvindo.ru",
|
|
306
308
|
log_extra: dict = None,
|
|
309
|
+
verify_ssl: bool = True,
|
|
307
310
|
):
|
|
308
311
|
"""
|
|
309
312
|
Args:
|
|
@@ -311,11 +314,16 @@ class KcResourceClient:
|
|
|
311
314
|
token: the bearer token; a leading "Bearer " prefix is stripped if present.
|
|
312
315
|
api_url: base URL of the Cloud API (no trailing slash).
|
|
313
316
|
log_extra: optional dict merged into every debug log record's `extra`.
|
|
317
|
+
verify_ssl: enable/disable TLS certificate verification for every
|
|
318
|
+
request this client makes. Defaults to True; pass False only
|
|
319
|
+
to point this SDK at a genuinely self-hosted instance with a
|
|
320
|
+
self-signed cert.
|
|
314
321
|
"""
|
|
315
322
|
self.__token = token.replace("Bearer ", "")
|
|
316
323
|
self.__resource_type = resource_type
|
|
317
324
|
self.__api_url = api_url
|
|
318
325
|
self.__log_extra = log_extra if log_extra is not None else {}
|
|
326
|
+
self.__verify_ssl = verify_ssl
|
|
319
327
|
|
|
320
328
|
def __headers(self) -> dict:
|
|
321
329
|
"""Standard auth + content-type headers for every request."""
|
|
@@ -342,7 +350,7 @@ class KcResourceClient:
|
|
|
342
350
|
"""
|
|
343
351
|
url = f"{self.__api_url}/api/v1/{self.__resource_type}/{id}"
|
|
344
352
|
|
|
345
|
-
response = create_http_client_with_retries().delete(url, headers=self.__headers())
|
|
353
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).delete(url, headers=self.__headers())
|
|
346
354
|
|
|
347
355
|
logger.debug(
|
|
348
356
|
f"Got {response.status_code} status code while making request DELETE {url}\nResponse body: {response.text}",
|
|
@@ -376,7 +384,7 @@ class KcResourceClient:
|
|
|
376
384
|
"""
|
|
377
385
|
url = f"{self.__api_url}/api/v1/{self.__resource_type}/{id}"
|
|
378
386
|
|
|
379
|
-
response = create_http_client_with_retries().get(url, headers=self.__headers())
|
|
387
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).get(url, headers=self.__headers())
|
|
380
388
|
|
|
381
389
|
logger.debug(
|
|
382
390
|
f"Got {response.status_code} status code while making request GET {url}\nResponse body: {response.text}",
|
|
@@ -418,7 +426,7 @@ class KcResourceClient:
|
|
|
418
426
|
}
|
|
419
427
|
|
|
420
428
|
url = create_url_with_query_params(url, params)
|
|
421
|
-
response = create_http_client_with_retries().get(url, headers=self.__headers())
|
|
429
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).get(url, headers=self.__headers())
|
|
422
430
|
|
|
423
431
|
logger.debug(
|
|
424
432
|
f"Got {response.status_code} status code while making request GET {url}\nResponse body: {response.text}",
|
|
@@ -447,7 +455,7 @@ class KcResourceClient:
|
|
|
447
455
|
"""
|
|
448
456
|
url = f"{self.__api_url}/api/v1/{self.__resource_type}/request/{request_id}"
|
|
449
457
|
|
|
450
|
-
response = create_http_client_with_retries().get(url, headers=self.__headers())
|
|
458
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).get(url, headers=self.__headers())
|
|
451
459
|
|
|
452
460
|
logger.debug(
|
|
453
461
|
f"Got {response.status_code} status code while making request GET {url}\nResponse body: {response.text}",
|
|
@@ -533,7 +541,7 @@ class KcResourceClient:
|
|
|
533
541
|
|
|
534
542
|
url = f"{self.__api_url}/api/v1/{self.__resource_type}"
|
|
535
543
|
|
|
536
|
-
response = create_http_client_with_retries().put(url, json=data, headers=self.__headers())
|
|
544
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).put(url, json=data, headers=self.__headers())
|
|
537
545
|
|
|
538
546
|
logger.debug(
|
|
539
547
|
f"Got {response.status_code} status code while making request PUT {url}\nRequest body: {data}\nResponse body: {response.text}",
|
|
@@ -658,6 +666,7 @@ class KcClient:
|
|
|
658
666
|
token: str,
|
|
659
667
|
api_url: str = "https://cloud-api.kvindo.ru",
|
|
660
668
|
log_extra: dict = None,
|
|
669
|
+
verify_ssl: bool = True,
|
|
661
670
|
):
|
|
662
671
|
"""
|
|
663
672
|
Args:
|
|
@@ -665,16 +674,21 @@ class KcClient:
|
|
|
665
674
|
api_url: base URL of the Cloud API (no trailing slash).
|
|
666
675
|
log_extra: optional dict merged into every debug log record's `extra`;
|
|
667
676
|
propagated to every per-resource client.
|
|
677
|
+
verify_ssl: enable/disable TLS certificate verification for every
|
|
678
|
+
request this client (and every per-resource client it builds)
|
|
679
|
+
makes. Defaults to True; pass False only to point this SDK at
|
|
680
|
+
a genuinely self-hosted instance with a self-signed cert.
|
|
668
681
|
"""
|
|
669
682
|
self.__log_extra = log_extra if log_extra is not None else {}
|
|
670
683
|
self.__token = token.replace("Bearer ", "")
|
|
671
684
|
self.__api_url = api_url
|
|
685
|
+
self.__verify_ssl = verify_ssl
|
|
672
686
|
# Cached response of get_transaction_collection_keys (lazy, fetched once).
|
|
673
687
|
self._transaction_collection_keys = None
|
|
674
688
|
|
|
675
689
|
def _r(resource_type: str) -> KcResourceClient:
|
|
676
|
-
"""Build a per-type client sharing this client's token/url/log_extra."""
|
|
677
|
-
return KcResourceClient(resource_type, token, api_url, log_extra)
|
|
690
|
+
"""Build a per-type client sharing this client's token/url/log_extra/verify_ssl."""
|
|
691
|
+
return KcResourceClient(resource_type, token, api_url, log_extra, verify_ssl)
|
|
678
692
|
|
|
679
693
|
# Compute
|
|
680
694
|
self.vms = _r("vm")
|
|
@@ -764,10 +778,22 @@ class KcClient:
|
|
|
764
778
|
|
|
765
779
|
Returns:
|
|
766
780
|
The raw list returned by the transaction-spec endpoint.
|
|
781
|
+
|
|
782
|
+
Raises:
|
|
783
|
+
Exception: on an unexpected HTTP status. Unlike the per-resource
|
|
784
|
+
methods, any non-200 here is treated as unhandled (this
|
|
785
|
+
endpoint has no typed error-code contract) — previously this
|
|
786
|
+
method cached whatever `.json()` returned regardless of status,
|
|
787
|
+
so a transient failure (e.g. an auth blip) got cached as if it
|
|
788
|
+
were the real key list, permanently, for this instance's life.
|
|
767
789
|
"""
|
|
768
790
|
if self._transaction_collection_keys is None:
|
|
769
791
|
url = f"{self.__api_url}/api/v1/internal/transaction-spec"
|
|
770
792
|
headers = {"Authorization": f"Bearer {self.__token}"}
|
|
771
|
-
response = create_http_client_with_retries().get(url, headers=headers)
|
|
793
|
+
response = create_http_client_with_retries(verify_ssl=self.__verify_ssl).get(url, headers=headers)
|
|
794
|
+
if response.status_code != 200:
|
|
795
|
+
raise Exception(
|
|
796
|
+
f"Got {response.status_code} status code while making request GET {url}\nResponse body: {response.text}"
|
|
797
|
+
)
|
|
772
798
|
self._transaction_collection_keys = response.json()
|
|
773
799
|
return self._transaction_collection_keys
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kc-sdk-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: Kvindo Cloud Python SDK — typed client for managing Kvindo Cloud infrastructure (VMs, S3, Kubernetes, load balancers, VPCs, PostgreSQL) via the REST API
|
|
5
5
|
Author: Kvindo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -45,6 +45,10 @@ balancers, VPCs, VPNs, and managed PostgreSQL.
|
|
|
45
45
|
A thin, typed client over the REST API: one resource client per resource type, all sharing the
|
|
46
46
|
same create / read / update / delete / list contract.
|
|
47
47
|
|
|
48
|
+
> **Using Claude Code?** This repo ships a [Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)
|
|
49
|
+
> that teaches Claude how to script Kvindo Cloud with this SDK — clone this repo (or otherwise have
|
|
50
|
+
> it on disk) and open Claude Code there to pick it up automatically.
|
|
51
|
+
|
|
48
52
|
## Install
|
|
49
53
|
|
|
50
54
|
```sh
|
|
@@ -59,6 +63,9 @@ Dependencies: `requests`, `marshmallow-dataclass`, `py-ulid`.
|
|
|
59
63
|
from kc_api import KcClient
|
|
60
64
|
|
|
61
65
|
client = KcClient("YOUR_API_TOKEN") # api_url defaults to https://cloud-api.kvindo.ru
|
|
66
|
+
# TLS certificate verification is on by default (verify_ssl=True). Pass
|
|
67
|
+
# verify_ssl=False only to point this SDK at a genuinely self-hosted instance
|
|
68
|
+
# with a self-signed cert.
|
|
62
69
|
|
|
63
70
|
# List (label-filtered, paginated)
|
|
64
71
|
resp = client.vms.get_by_labels({"env": "prod"}, max_page_size=50)
|
|
@@ -101,6 +108,7 @@ Part of the Kvindo Cloud developer toolchain:
|
|
|
101
108
|
- **[kc CLI](https://github.com/Kvindo/kc-cli)** — kubectl-style command-line client for Kvindo Cloud.
|
|
102
109
|
- **[terraform-provider-kvindo](https://github.com/Kvindo/terraform-provider-kvindo)** — Terraform provider ([Registry](https://registry.terraform.io/providers/kvindo/kvindo/latest)).
|
|
103
110
|
- **[Kvindo Cloud console](https://cloud.kvindo.com)** — web UI and API.
|
|
111
|
+
- **[Claude Code skill](.claude/skills/kvindo-python-sdk/SKILL.md)** — lets Claude script Kvindo Cloud with this SDK conversationally.
|
|
104
112
|
|
|
105
113
|
## License
|
|
106
114
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "kc-sdk-python"
|
|
7
|
-
version = "3.
|
|
7
|
+
version = "3.1.0"
|
|
8
8
|
description = "Kvindo Cloud Python SDK — typed client for managing Kvindo Cloud infrastructure (VMs, S3, Kubernetes, load balancers, VPCs, PostgreSQL) via the REST API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|