codecraftai-restclient-coreweave 1.2.0__py3-none-any.whl

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.
Files changed (34) hide show
  1. ccai/restclient/coreweave/__init__.py +12 -0
  2. ccai/restclient/coreweave/apigroups/__init__.py +11 -0
  3. ccai/restclient/coreweave/apigroups/acceleratorsgroup.py +114 -0
  4. ccai/restclient/coreweave/apigroups/clustersgroup.py +102 -0
  5. ccai/restclient/coreweave/apigroups/groupsupport.py +91 -0
  6. ccai/restclient/coreweave/apigroups/kubeconfigsgroup.py +100 -0
  7. ccai/restclient/coreweave/apigroups/nodepoolsgroup.py +76 -0
  8. ccai/restclient/coreweave/apigroups/objectnamespacesgroup.py +119 -0
  9. ccai/restclient/coreweave/apigroups/operationsgroup.py +69 -0
  10. ccai/restclient/coreweave/apigroups/organizationsgroup.py +69 -0
  11. ccai/restclient/coreweave/apigroups/projectsgroup.py +76 -0
  12. ccai/restclient/coreweave/apigroups/sshkeysgroup.py +134 -0
  13. ccai/restclient/coreweave/apigroups/tagsgroup.py +102 -0
  14. ccai/restclient/coreweave/aspectscoreweave.py +119 -0
  15. ccai/restclient/coreweave/coreweaveclient.py +412 -0
  16. ccai/restclient/coreweave/exceptions/__init__.py +11 -0
  17. ccai/restclient/coreweave/exceptions/coreweaveerrors.py +55 -0
  18. ccai/restclient/coreweave/model/__init__.py +11 -0
  19. ccai/restclient/coreweave/model/coreweaveacceleratorsku.py +59 -0
  20. ccai/restclient/coreweave/model/coreweavecluster.py +69 -0
  21. ccai/restclient/coreweave/model/coreweavekubeconfig.py +90 -0
  22. ccai/restclient/coreweave/model/coreweavenodepool.py +72 -0
  23. ccai/restclient/coreweave/model/coreweaveobjectnamespace.py +59 -0
  24. ccai/restclient/coreweave/model/coreweaveoperationresult.py +76 -0
  25. ccai/restclient/coreweave/model/coreweaveorganization.py +58 -0
  26. ccai/restclient/coreweave/model/coreweaveproject.py +59 -0
  27. ccai/restclient/coreweave/model/coreweavesshkey.py +55 -0
  28. ccai/restclient/coreweave/model/coreweavetaskhandle.py +174 -0
  29. ccai/restclient/coreweave/py.typed +0 -0
  30. ccai/restclient/coreweave/urlcompose.py +94 -0
  31. codecraftai_restclient_coreweave-1.2.0.dist-info/METADATA +87 -0
  32. codecraftai_restclient_coreweave-1.2.0.dist-info/RECORD +34 -0
  33. codecraftai_restclient_coreweave-1.2.0.dist-info/WHEEL +4 -0
  34. codecraftai_restclient_coreweave-1.2.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,12 @@
1
+ """
2
+ .. module:: coreweave
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``ccai.restclient.coreweave`` package — the CoreWeave
5
+ control-plane REST client.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
12
+ __credits__ = []
@@ -0,0 +1,11 @@
1
+ """
2
+ .. module:: apigroups
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The CoreWeave client api-group subpackage.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
@@ -0,0 +1,114 @@
1
+ """
2
+ .. module:: acceleratorsgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``accelerators`` api group of the CoreWeave client.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+
14
+ import os
15
+
16
+ from typing import Any, Dict, List
17
+
18
+ from ccai.restclient.coreweave.aspectscoreweave import (
19
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
20
+ )
21
+ from ccai.restclient.coreweave.apigroups.groupsupport import collect_paged_items
22
+ from ccai.restclient.coreweave.exceptions.coreweaveerrors import (
23
+ CoreweaveAcceleratorNotAvailableError
24
+ )
25
+ from ccai.restclient.coreweave.model.coreweaveacceleratorsku import (
26
+ CoreweaveAcceleratorSku
27
+ )
28
+ from ccai.restclient.coreweave.urlcompose import require_identifier
29
+
30
+
31
+ class AcceleratorsGroup:
32
+ """
33
+ The ``accelerators`` api group enumerates the GPU SKU catalog of a
34
+ CoreWeave project.
35
+ """
36
+
37
+ def __init__(self, *, client: Any) -> None:
38
+ """
39
+ Initialize the api group.
40
+
41
+ :param client: The owning :class:`CoreweaveClient`.
42
+
43
+ :returns: ``None``.
44
+ """
45
+ self._client = client
46
+ return
47
+
48
+ def list_skus(self, *, project_id: str,
49
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> List[CoreweaveAcceleratorSku]:
50
+ """
51
+ Enumerate the GPU SKU catalog of a project.
52
+
53
+ :param project_id: The owning project identifier.
54
+ :param aspects: Behaviour control for the call.
55
+
56
+ :returns: A list of :class:`CoreweaveAcceleratorSku` records.
57
+
58
+ :raises: :class:`SemanticError` when ``project_id`` is empty or
59
+ ``None``.
60
+ """
61
+ validated_project = require_identifier(name="project_id",
62
+ value=project_id)
63
+
64
+ def fetch_page(query_params: Dict[str, str]) -> Dict[str, Any]:
65
+ page = self._client.request_json(
66
+ method="GET",
67
+ segments=("v1", "projects", validated_project,
68
+ "accelerator-skus"),
69
+ params=query_params,
70
+ body=None,
71
+ aspects=aspects)
72
+ return page
73
+
74
+ item_dicts = collect_paged_items(fetch_page=fetch_page)
75
+
76
+ rtnval: List[CoreweaveAcceleratorSku] = []
77
+ for item in item_dicts:
78
+ record = CoreweaveAcceleratorSku.from_payload(payload=item)
79
+ rtnval.append(record)
80
+
81
+ return rtnval
82
+
83
+ def require_sku(self, *, project_id: str, sku_name: str,
84
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> CoreweaveAcceleratorSku:
85
+ """
86
+ Resolve a single SKU by name, failing loudly when absent.
87
+
88
+ :param project_id: The owning project identifier.
89
+ :param sku_name: The catalog SKU name to resolve.
90
+ :param aspects: Behaviour control for the call.
91
+
92
+ :returns: The matching :class:`CoreweaveAcceleratorSku`.
93
+
94
+ :raises: :class:`CoreweaveAcceleratorNotAvailableError` when the
95
+ SKU is not present in the project catalog.
96
+ """
97
+ catalog = self.list_skus(project_id=project_id, aspects=aspects)
98
+
99
+ for sku in catalog:
100
+ if sku.name == sku_name:
101
+ rtnval = sku
102
+ return rtnval
103
+
104
+ err_msg_lines = ["The requested accelerator SKU is not available."]
105
+ err_msg_lines.append("SKU: {}".format(sku_name))
106
+ err_msg_lines.append("PROJECT: {}".format(project_id))
107
+ err_msg_lines.append("CATALOG: ({})".format(len(catalog)))
108
+ for sku in catalog:
109
+ err_msg_lines.append(" {}".format(sku.name))
110
+ err_msg = os.linesep.join(err_msg_lines)
111
+ raise CoreweaveAcceleratorNotAvailableError(err_msg)
112
+
113
+
114
+ __all__ = ["AcceleratorsGroup"]
@@ -0,0 +1,102 @@
1
+ """
2
+ .. module:: clustersgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``clusters`` api group of the CoreWeave client.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+
14
+ from typing import Any, Dict, List
15
+
16
+ from ccai.restclient.coreweave.aspectscoreweave import (
17
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
18
+ )
19
+ from ccai.restclient.coreweave.apigroups.groupsupport import collect_paged_items
20
+ from ccai.restclient.coreweave.model.coreweavecluster import CoreweaveCluster
21
+ from ccai.restclient.coreweave.urlcompose import require_identifier
22
+
23
+
24
+ class ClustersGroup:
25
+ """
26
+ The ``clusters`` api group enumerates and reads CoreWeave Kubernetes
27
+ Service (CKS) clusters.
28
+ """
29
+
30
+ def __init__(self, *, client: Any) -> None:
31
+ """
32
+ Initialize the api group.
33
+
34
+ :param client: The owning :class:`CoreweaveClient`.
35
+
36
+ :returns: ``None``.
37
+ """
38
+ self._client = client
39
+ return
40
+
41
+ def list(self, *, project_id: str,
42
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> List[CoreweaveCluster]:
43
+ """
44
+ Enumerate the CKS clusters of a project.
45
+
46
+ :param project_id: The owning project identifier.
47
+ :param aspects: Behaviour control for the call.
48
+
49
+ :returns: A list of :class:`CoreweaveCluster` records.
50
+
51
+ :raises: :class:`SemanticError` when ``project_id`` is empty or
52
+ ``None``.
53
+ """
54
+ validated_project = require_identifier(name="project_id",
55
+ value=project_id)
56
+
57
+ def fetch_page(query_params: Dict[str, str]) -> Dict[str, Any]:
58
+ page = self._client.request_json(
59
+ method="GET",
60
+ segments=("v1", "projects", validated_project, "clusters"),
61
+ params=query_params,
62
+ body=None,
63
+ aspects=aspects)
64
+ return page
65
+
66
+ item_dicts = collect_paged_items(fetch_page=fetch_page)
67
+
68
+ rtnval: List[CoreweaveCluster] = []
69
+ for item in item_dicts:
70
+ record = CoreweaveCluster.from_payload(payload=item)
71
+ rtnval.append(record)
72
+
73
+ return rtnval
74
+
75
+ def get(self, *, cluster_id: str,
76
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> CoreweaveCluster:
77
+ """
78
+ Read a single CKS cluster by identifier.
79
+
80
+ :param cluster_id: The cluster identifier.
81
+ :param aspects: Behaviour control for the call.
82
+
83
+ :returns: A :class:`CoreweaveCluster` record.
84
+
85
+ :raises: :class:`SemanticError` when ``cluster_id`` is empty or
86
+ ``None``.
87
+ """
88
+ validated_cluster = require_identifier(name="cluster_id",
89
+ value=cluster_id)
90
+
91
+ payload = self._client.request_json(
92
+ method="GET",
93
+ segments=("v1", "clusters", validated_cluster),
94
+ params=None,
95
+ body=None,
96
+ aspects=aspects)
97
+
98
+ rtnval = CoreweaveCluster.from_payload(payload=payload)
99
+ return rtnval
100
+
101
+
102
+ __all__ = ["ClustersGroup"]
@@ -0,0 +1,91 @@
1
+ """
2
+ .. module:: groupsupport
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Shared helpers used by the CoreWeave api-group classes —
5
+ JSON decoding and transparent paging-cursor traversal.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ from typing import Any, Callable, Dict, List
16
+
17
+ from requests import Response
18
+
19
+
20
+ def safe_json(*, response: Response) -> Dict[str, Any]:
21
+ """
22
+ Parse a response body as a JSON object, degrading to an empty dict.
23
+
24
+ :param response: The :class:`Response` to parse.
25
+
26
+ :returns: The decoded object, or an empty dict.
27
+ """
28
+ try:
29
+ payload = response.json()
30
+ except ValueError:
31
+ rtnval: Dict[str, Any] = {}
32
+ return rtnval
33
+
34
+ if not isinstance(payload, dict):
35
+ rtnval = {}
36
+ return rtnval
37
+
38
+ rtnval = payload
39
+ return rtnval
40
+
41
+
42
+ def collect_paged_items(*, fetch_page: Callable[[Dict[str, str]], Dict[str, Any]],
43
+ items_key: str = "items") -> List[Dict[str, Any]]:
44
+ """
45
+ Traverse every page of a paged CoreWeave list endpoint and return the
46
+ concatenated union of items.
47
+
48
+ The traversal follows the ``next_cursor`` field returned in each page
49
+ payload until the field is absent or empty. The result is a single
50
+ concatenated list, in page order, with no item dropped or duplicated.
51
+
52
+ :param fetch_page: A callable that, given a query-parameter dict,
53
+ issues one page request and returns the decoded page payload.
54
+ The first call receives an empty dict; subsequent calls receive
55
+ ``{"cursor": <token>}``.
56
+ :param items_key: The payload key holding the per-page item list.
57
+
58
+ :returns: The concatenated list of item dicts across all pages.
59
+ """
60
+ collected: List[Dict[str, Any]] = []
61
+ query_params: Dict[str, str] = {}
62
+ seen_cursors = set()
63
+
64
+ while True:
65
+ page = fetch_page(query_params)
66
+
67
+ page_items = page.get(items_key, None)
68
+ if page_items is not None:
69
+ for item in page_items:
70
+ collected.append(item)
71
+
72
+ next_cursor = page.get("next_cursor", None)
73
+
74
+ if next_cursor is None:
75
+ break
76
+
77
+ if len(next_cursor) == 0:
78
+ break
79
+
80
+ if next_cursor in seen_cursors:
81
+ # Defensive guard against a server returning a cyclic cursor.
82
+ break
83
+
84
+ seen_cursors.add(next_cursor)
85
+ query_params = {"cursor": next_cursor}
86
+
87
+ rtnval = collected
88
+ return rtnval
89
+
90
+
91
+ __all__ = ["safe_json", "collect_paged_items"]
@@ -0,0 +1,100 @@
1
+ """
2
+ .. module:: kubeconfigsgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``kubeconfigs`` api group of the CoreWeave client. This
5
+ group implements the §7 decision: CoreWeave mints a kubeconfig; the
6
+ client returns it; it never speaks the Kubernetes API.
7
+
8
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
9
+ """
10
+
11
+ __author__ = "Myron Walker"
12
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
13
+ __credits__ = []
14
+
15
+
16
+ import os
17
+
18
+ from typing import Any
19
+
20
+ from ccai.restclient.coreweave.aspectscoreweave import (
21
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
22
+ )
23
+ from ccai.restclient.coreweave.exceptions.coreweaveerrors import (
24
+ CoreweaveKubeconfigError
25
+ )
26
+ from ccai.restclient.coreweave.model.coreweavekubeconfig import (
27
+ CoreweaveKubeconfig
28
+ )
29
+ from ccai.restclient.coreweave.urlcompose import require_identifier
30
+
31
+
32
+ class KubeconfigsGroup:
33
+ """
34
+ The ``kubeconfigs`` api group exchanges the API credential for a
35
+ scoped kubeconfig for a CKS cluster.
36
+
37
+ This group never invokes a Kubernetes API endpoint. It POSTs to the
38
+ CoreWeave control plane's kubeconfig-issuance endpoint and returns
39
+ the minted material as a :class:`CoreweaveKubeconfig` record.
40
+ """
41
+
42
+ def __init__(self, *, client: Any) -> None:
43
+ """
44
+ Initialize the api group.
45
+
46
+ :param client: The owning :class:`CoreweaveClient`.
47
+
48
+ :returns: ``None``.
49
+ """
50
+ self._client = client
51
+ return
52
+
53
+ def issue(self, *, cluster_id: str,
54
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> CoreweaveKubeconfig:
55
+ """
56
+ Issue a scoped kubeconfig for a CKS cluster.
57
+
58
+ :param cluster_id: The cluster to issue a kubeconfig for.
59
+ :param aspects: Behaviour control for the call. The requested
60
+ TTL is taken from ``aspects.kubeconfig_ttl_seconds``.
61
+
62
+ :returns: A :class:`CoreweaveKubeconfig` carrying the YAML
63
+ payload, expiry, and API-server URL.
64
+
65
+ :raises: :class:`SemanticError` when ``cluster_id`` is empty.
66
+ :raises: :class:`CoreweaveKubeconfigError` when the issued
67
+ kubeconfig is malformed or missing required fields.
68
+ """
69
+ validated_cluster = require_identifier(name="cluster_id",
70
+ value=cluster_id)
71
+
72
+ body = {"ttl_seconds": aspects.kubeconfig_ttl_seconds}
73
+
74
+ payload = self._client.request_json(
75
+ method="POST",
76
+ segments=("v1", "clusters", validated_cluster, "kubeconfig"),
77
+ params=None,
78
+ body=body,
79
+ aspects=aspects)
80
+
81
+ kubeconfig = CoreweaveKubeconfig.from_payload(payload=payload,
82
+ cluster_id=validated_cluster)
83
+
84
+ if kubeconfig.yaml_payload is None or len(kubeconfig.yaml_payload) == 0:
85
+ err_msg_lines = ["The issued kubeconfig is missing its YAML payload."]
86
+ err_msg_lines.append("CLUSTER: {}".format(validated_cluster))
87
+ err_msg = os.linesep.join(err_msg_lines)
88
+ raise CoreweaveKubeconfigError(err_msg)
89
+
90
+ if kubeconfig.api_endpoint is None or len(kubeconfig.api_endpoint) == 0:
91
+ err_msg_lines = ["The issued kubeconfig is missing the API endpoint."]
92
+ err_msg_lines.append("CLUSTER: {}".format(validated_cluster))
93
+ err_msg = os.linesep.join(err_msg_lines)
94
+ raise CoreweaveKubeconfigError(err_msg)
95
+
96
+ rtnval = kubeconfig
97
+ return rtnval
98
+
99
+
100
+ __all__ = ["KubeconfigsGroup"]
@@ -0,0 +1,76 @@
1
+ """
2
+ .. module:: nodepoolsgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``node-pools`` api group of the CoreWeave client.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+
14
+ from typing import Any, Dict, List
15
+
16
+ from ccai.restclient.coreweave.aspectscoreweave import (
17
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
18
+ )
19
+ from ccai.restclient.coreweave.apigroups.groupsupport import collect_paged_items
20
+ from ccai.restclient.coreweave.model.coreweavenodepool import CoreweaveNodePool
21
+ from ccai.restclient.coreweave.urlcompose import require_identifier
22
+
23
+
24
+ class NodePoolsGroup:
25
+ """
26
+ The ``node-pools`` api group enumerates the node pools (including
27
+ accelerator pools) of a CKS cluster.
28
+ """
29
+
30
+ def __init__(self, *, client: Any) -> None:
31
+ """
32
+ Initialize the api group.
33
+
34
+ :param client: The owning :class:`CoreweaveClient`.
35
+
36
+ :returns: ``None``.
37
+ """
38
+ self._client = client
39
+ return
40
+
41
+ def list(self, *, cluster_id: str,
42
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> List[CoreweaveNodePool]:
43
+ """
44
+ Enumerate the node pools of a CKS cluster.
45
+
46
+ :param cluster_id: The owning cluster identifier.
47
+ :param aspects: Behaviour control for the call.
48
+
49
+ :returns: A list of :class:`CoreweaveNodePool` records.
50
+
51
+ :raises: :class:`SemanticError` when ``cluster_id`` is empty or
52
+ ``None``.
53
+ """
54
+ validated_cluster = require_identifier(name="cluster_id",
55
+ value=cluster_id)
56
+
57
+ def fetch_page(query_params: Dict[str, str]) -> Dict[str, Any]:
58
+ page = self._client.request_json(
59
+ method="GET",
60
+ segments=("v1", "clusters", validated_cluster, "node-pools"),
61
+ params=query_params,
62
+ body=None,
63
+ aspects=aspects)
64
+ return page
65
+
66
+ item_dicts = collect_paged_items(fetch_page=fetch_page)
67
+
68
+ rtnval: List[CoreweaveNodePool] = []
69
+ for item in item_dicts:
70
+ record = CoreweaveNodePool.from_payload(payload=item)
71
+ rtnval.append(record)
72
+
73
+ return rtnval
74
+
75
+
76
+ __all__ = ["NodePoolsGroup"]
@@ -0,0 +1,119 @@
1
+ """
2
+ .. module:: objectnamespacesgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``object-namespaces`` api group of the CoreWeave client.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+
14
+ from typing import Any, Dict, List
15
+
16
+ from ccai.restclient.coreweave.aspectscoreweave import (
17
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
18
+ )
19
+ from ccai.restclient.coreweave.apigroups.groupsupport import collect_paged_items
20
+ from ccai.restclient.coreweave.model.coreweaveobjectnamespace import (
21
+ CoreweaveObjectNamespace
22
+ )
23
+ from ccai.restclient.coreweave.urlcompose import require_identifier
24
+
25
+
26
+ class ObjectNamespacesGroup:
27
+ """
28
+ The ``object-namespaces`` api group creates and lists CoreWeave
29
+ object-storage namespaces. Creation is idempotent
30
+ (read-before-create on name + region).
31
+ """
32
+
33
+ def __init__(self, *, client: Any) -> None:
34
+ """
35
+ Initialize the api group.
36
+
37
+ :param client: The owning :class:`CoreweaveClient`.
38
+
39
+ :returns: ``None``.
40
+ """
41
+ self._client = client
42
+ return
43
+
44
+ def list(self, *, project_id: str,
45
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> List[CoreweaveObjectNamespace]:
46
+ """
47
+ Enumerate the object-storage namespaces of a project.
48
+
49
+ :param project_id: The owning project identifier.
50
+ :param aspects: Behaviour control for the call.
51
+
52
+ :returns: A list of :class:`CoreweaveObjectNamespace` records.
53
+
54
+ :raises: :class:`SemanticError` when ``project_id`` is empty.
55
+ """
56
+ validated_project = require_identifier(name="project_id",
57
+ value=project_id)
58
+
59
+ def fetch_page(query_params: Dict[str, str]) -> Dict[str, Any]:
60
+ page = self._client.request_json(
61
+ method="GET",
62
+ segments=("v1", "projects", validated_project,
63
+ "object-namespaces"),
64
+ params=query_params,
65
+ body=None,
66
+ aspects=aspects)
67
+ return page
68
+
69
+ item_dicts = collect_paged_items(fetch_page=fetch_page)
70
+
71
+ rtnval: List[CoreweaveObjectNamespace] = []
72
+ for item in item_dicts:
73
+ record = CoreweaveObjectNamespace.from_payload(payload=item)
74
+ rtnval.append(record)
75
+
76
+ return rtnval
77
+
78
+ def create(self, *, project_id: str, name: str, region: str,
79
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> CoreweaveObjectNamespace:
80
+ """
81
+ Create an object-storage namespace.
82
+
83
+ The call is idempotent: when a namespace with the same name in
84
+ the same region already exists the existing record is returned.
85
+
86
+ :param project_id: The owning project identifier.
87
+ :param name: The namespace name.
88
+ :param region: The region the namespace should live in.
89
+ :param aspects: Behaviour control for the call.
90
+
91
+ :returns: A :class:`CoreweaveObjectNamespace` record.
92
+
93
+ :raises: :class:`SemanticError` when ``project_id`` or ``name``
94
+ is empty.
95
+ """
96
+ validated_project = require_identifier(name="project_id",
97
+ value=project_id)
98
+ validated_name = require_identifier(name="name", value=name)
99
+
100
+ existing = self.list(project_id=validated_project, aspects=aspects)
101
+ for namespace in existing:
102
+ if namespace.name == validated_name and namespace.region == region:
103
+ rtnval = namespace
104
+ return rtnval
105
+
106
+ body = {"name": validated_name, "region": region}
107
+
108
+ payload = self._client.request_json(
109
+ method="POST",
110
+ segments=("v1", "projects", validated_project, "object-namespaces"),
111
+ params=None,
112
+ body=body,
113
+ aspects=aspects)
114
+
115
+ rtnval = CoreweaveObjectNamespace.from_payload(payload=payload)
116
+ return rtnval
117
+
118
+
119
+ __all__ = ["ObjectNamespacesGroup"]
@@ -0,0 +1,69 @@
1
+ """
2
+ .. module:: operationsgroup
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The ``operations`` api group of the CoreWeave client.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+
14
+ from typing import Any
15
+
16
+ from ccai.restclient.coreweave.aspectscoreweave import (
17
+ AspectsCoreweave, DEFAULT_COREWEAVE_ASPECTS
18
+ )
19
+ from ccai.restclient.coreweave.model.coreweaveoperationresult import (
20
+ CoreweaveOperationResult
21
+ )
22
+ from ccai.restclient.coreweave.urlcompose import require_identifier
23
+
24
+
25
+ class OperationsGroup:
26
+ """
27
+ The ``operations`` api group reads the status of long-running
28
+ CoreWeave control-plane operations. It backs
29
+ :class:`CoreweaveTaskHandle.wait`.
30
+ """
31
+
32
+ def __init__(self, *, client: Any) -> None:
33
+ """
34
+ Initialize the api group.
35
+
36
+ :param client: The owning :class:`CoreweaveClient`.
37
+
38
+ :returns: ``None``.
39
+ """
40
+ self._client = client
41
+ return
42
+
43
+ def get(self, *, operation_id: str,
44
+ aspects: AspectsCoreweave = DEFAULT_COREWEAVE_ASPECTS) -> CoreweaveOperationResult:
45
+ """
46
+ Read the status of a long-running operation.
47
+
48
+ :param operation_id: The operation identifier.
49
+ :param aspects: Behaviour control for the call.
50
+
51
+ :returns: A :class:`CoreweaveOperationResult`.
52
+
53
+ :raises: :class:`SemanticError` when ``operation_id`` is empty.
54
+ """
55
+ validated_operation = require_identifier(name="operation_id",
56
+ value=operation_id)
57
+
58
+ payload = self._client.request_json(
59
+ method="GET",
60
+ segments=("v1", "operations", validated_operation),
61
+ params=None,
62
+ body=None,
63
+ aspects=aspects)
64
+
65
+ rtnval = CoreweaveOperationResult.from_payload(payload=payload)
66
+ return rtnval
67
+
68
+
69
+ __all__ = ["OperationsGroup"]