codecraftai-restclient-oracle 1.3.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.
- ccai/restclient/oracle/__init__.py +11 -0
- ccai/restclient/oracle/ociclients.py +512 -0
- ccai/restclient/oracle/ocierror.py +59 -0
- ccai/restclient/oracle/ocimodels.py +330 -0
- ccai/restclient/oracle/ocipagination.py +96 -0
- ccai/restclient/oracle/ocisigner.py +278 -0
- ccai/restclient/oracle/ocitransport.py +212 -0
- codecraftai_restclient_oracle-1.3.0.dist-info/METADATA +76 -0
- codecraftai_restclient_oracle-1.3.0.dist-info/RECORD +11 -0
- codecraftai_restclient_oracle-1.3.0.dist-info/WHEEL +4 -0
- codecraftai_restclient_oracle-1.3.0.dist-info/licenses/LICENSE.md +204 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. package:: ccai.restclient.oracle
|
|
3
|
+
:platform: Darwin, Linux, Unix, Windows
|
|
4
|
+
:synopsis: A pure-Python client for Oracle Cloud Infrastructure.
|
|
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,512 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. module:: ociclients
|
|
3
|
+
:platform: Darwin, Linux, Unix, Windows
|
|
4
|
+
:synopsis: The OCI service clients.
|
|
5
|
+
|
|
6
|
+
Method and keyword names match the ``oci`` SDK's exactly — including the
|
|
7
|
+
inconsistencies, which are the SDK's own: the details keyword is
|
|
8
|
+
``create_vcn_details`` for one call and ``create_instance_configuration``
|
|
9
|
+
for another, and identifiers are abbreviated for some resources
|
|
10
|
+
(``ig_id``, ``rt_id``) but not others (``security_list_id``). Those are
|
|
11
|
+
reproduced rather than tidied, because consumer code already passes them.
|
|
12
|
+
|
|
13
|
+
.. moduleauthor:: Myron Walker <myron.walker@gmail.com>
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
__author__ = "Myron Walker"
|
|
17
|
+
__copyright__ = "Copyright 2026, Code Craft AI LLC"
|
|
18
|
+
__credits__ = []
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
from typing import Any, Dict, Optional
|
|
22
|
+
|
|
23
|
+
from ccai.restclient.oracle.ocimodels import Response, serialize
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
CORE_API_VERSION = "20160918"
|
|
27
|
+
|
|
28
|
+
DNS_API_VERSION = "20180115"
|
|
29
|
+
|
|
30
|
+
FILE_STORAGE_API_VERSION = "20171215"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _endpoint(*, service: str, region: str, domain: str) -> str:
|
|
34
|
+
"""
|
|
35
|
+
Build a regional service endpoint.
|
|
36
|
+
|
|
37
|
+
:param service: The service hostname prefix.
|
|
38
|
+
:param region: The region identifier.
|
|
39
|
+
:param domain: The realm domain.
|
|
40
|
+
|
|
41
|
+
:returns: The endpoint URL.
|
|
42
|
+
"""
|
|
43
|
+
rtnval = "https://{}.{}.{}".format(service, region, domain)
|
|
44
|
+
return rtnval
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class _ServiceClient:
|
|
48
|
+
"""
|
|
49
|
+
Shared behaviour for an OCI service client.
|
|
50
|
+
|
|
51
|
+
:cvar SERVICE: The service hostname prefix.
|
|
52
|
+
:cvar API_VERSION: The path version segment.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
SERVICE: str = ""
|
|
56
|
+
API_VERSION: str = ""
|
|
57
|
+
|
|
58
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None, *,
|
|
59
|
+
transport: Any = None, region: str = "",
|
|
60
|
+
domain: str = "oraclecloud.com",
|
|
61
|
+
endpoint: Optional[str] = None) -> None:
|
|
62
|
+
"""
|
|
63
|
+
Construct a service client.
|
|
64
|
+
|
|
65
|
+
Accepts the config dict positionally, matching how the SDK
|
|
66
|
+
clients were built and how the venue's session factory calls
|
|
67
|
+
them.
|
|
68
|
+
|
|
69
|
+
:param config: The OCI config dict, carrying at least ``region``.
|
|
70
|
+
:param transport: The shared :class:`OciTransport`.
|
|
71
|
+
:param region: The region, when not taken from the config.
|
|
72
|
+
:param domain: The realm domain.
|
|
73
|
+
:param endpoint: An explicit endpoint override.
|
|
74
|
+
"""
|
|
75
|
+
settings = config or {}
|
|
76
|
+
|
|
77
|
+
self._transport = transport
|
|
78
|
+
self._region = region or str(settings.get("region", ""))
|
|
79
|
+
self._domain = domain
|
|
80
|
+
|
|
81
|
+
if endpoint is not None:
|
|
82
|
+
self._endpoint = endpoint.rstrip("/")
|
|
83
|
+
else:
|
|
84
|
+
self._endpoint = _endpoint(service=self.SERVICE,
|
|
85
|
+
region=self._region,
|
|
86
|
+
domain=self._domain)
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def base_url(self) -> str:
|
|
91
|
+
"""
|
|
92
|
+
Return the endpoint this client addresses.
|
|
93
|
+
|
|
94
|
+
:returns: The endpoint URL.
|
|
95
|
+
"""
|
|
96
|
+
rtnval = self._endpoint
|
|
97
|
+
return rtnval
|
|
98
|
+
|
|
99
|
+
def _url(self, path: str) -> str:
|
|
100
|
+
"""
|
|
101
|
+
Build a versioned absolute URL.
|
|
102
|
+
|
|
103
|
+
:param path: The path below the version segment.
|
|
104
|
+
|
|
105
|
+
:returns: The absolute URL.
|
|
106
|
+
"""
|
|
107
|
+
rtnval = "{}/{}{}".format(self._endpoint, self.API_VERSION, path)
|
|
108
|
+
return rtnval
|
|
109
|
+
|
|
110
|
+
def _call(self, *, method: str, path: str,
|
|
111
|
+
params: Optional[Dict[str, Any]] = None,
|
|
112
|
+
details: Any = None) -> Response:
|
|
113
|
+
"""
|
|
114
|
+
Perform one call against this service.
|
|
115
|
+
|
|
116
|
+
:param method: The HTTP method.
|
|
117
|
+
:param path: The path below the version segment.
|
|
118
|
+
:param params: Optional query parameters.
|
|
119
|
+
:param details: Optional request model, serialised to the wire.
|
|
120
|
+
|
|
121
|
+
:returns: The :class:`Response`.
|
|
122
|
+
"""
|
|
123
|
+
body = None
|
|
124
|
+
if details is not None:
|
|
125
|
+
body = serialize(details)
|
|
126
|
+
|
|
127
|
+
rtnval = self._transport.request(method=method, url=self._url(path),
|
|
128
|
+
params=params, body=body)
|
|
129
|
+
return rtnval
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class VirtualNetworkClient(_ServiceClient):
|
|
133
|
+
"""
|
|
134
|
+
The Core Services networking client.
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
SERVICE = "iaas"
|
|
138
|
+
API_VERSION = CORE_API_VERSION
|
|
139
|
+
|
|
140
|
+
def create_vcn(self, *, create_vcn_details: Any) -> Response:
|
|
141
|
+
"""Create a VCN."""
|
|
142
|
+
return self._call(method="POST", path="/vcns",
|
|
143
|
+
details=create_vcn_details)
|
|
144
|
+
|
|
145
|
+
def delete_vcn(self, *, vcn_id: str) -> Response:
|
|
146
|
+
"""Delete a VCN."""
|
|
147
|
+
return self._call(method="DELETE",
|
|
148
|
+
path="/vcns/{}".format(vcn_id))
|
|
149
|
+
|
|
150
|
+
def list_vcns(self, *, compartment_id: str,
|
|
151
|
+
**filters: Any) -> Response:
|
|
152
|
+
"""List VCNs in a compartment."""
|
|
153
|
+
params = {"compartmentId": compartment_id}
|
|
154
|
+
params.update(_camel_params(filters))
|
|
155
|
+
return self._call(method="GET", path="/vcns", params=params)
|
|
156
|
+
|
|
157
|
+
def create_subnet(self, *, create_subnet_details: Any) -> Response:
|
|
158
|
+
"""Create a subnet."""
|
|
159
|
+
return self._call(method="POST", path="/subnets",
|
|
160
|
+
details=create_subnet_details)
|
|
161
|
+
|
|
162
|
+
def delete_subnet(self, *, subnet_id: str) -> Response:
|
|
163
|
+
"""Delete a subnet."""
|
|
164
|
+
return self._call(method="DELETE",
|
|
165
|
+
path="/subnets/{}".format(subnet_id))
|
|
166
|
+
|
|
167
|
+
def list_subnets(self, *, compartment_id: str,
|
|
168
|
+
**filters: Any) -> Response:
|
|
169
|
+
"""List subnets in a compartment."""
|
|
170
|
+
params = {"compartmentId": compartment_id}
|
|
171
|
+
params.update(_camel_params(filters))
|
|
172
|
+
return self._call(method="GET", path="/subnets", params=params)
|
|
173
|
+
|
|
174
|
+
def create_internet_gateway(self, *,
|
|
175
|
+
create_internet_gateway_details: Any
|
|
176
|
+
) -> Response:
|
|
177
|
+
"""Create an internet gateway."""
|
|
178
|
+
return self._call(method="POST", path="/internetGateways",
|
|
179
|
+
details=create_internet_gateway_details)
|
|
180
|
+
|
|
181
|
+
def delete_internet_gateway(self, *, ig_id: str) -> Response:
|
|
182
|
+
"""Delete an internet gateway. The SDK abbreviates the keyword."""
|
|
183
|
+
return self._call(method="DELETE",
|
|
184
|
+
path="/internetGateways/{}".format(ig_id))
|
|
185
|
+
|
|
186
|
+
def list_internet_gateways(self, *, compartment_id: str,
|
|
187
|
+
**filters: Any) -> Response:
|
|
188
|
+
"""List internet gateways in a compartment."""
|
|
189
|
+
params = {"compartmentId": compartment_id}
|
|
190
|
+
params.update(_camel_params(filters))
|
|
191
|
+
return self._call(method="GET", path="/internetGateways",
|
|
192
|
+
params=params)
|
|
193
|
+
|
|
194
|
+
def create_route_table(self, *,
|
|
195
|
+
create_route_table_details: Any) -> Response:
|
|
196
|
+
"""Create a route table."""
|
|
197
|
+
return self._call(method="POST", path="/routeTables",
|
|
198
|
+
details=create_route_table_details)
|
|
199
|
+
|
|
200
|
+
def delete_route_table(self, *, rt_id: str) -> Response:
|
|
201
|
+
"""Delete a route table. The SDK abbreviates the keyword."""
|
|
202
|
+
return self._call(method="DELETE",
|
|
203
|
+
path="/routeTables/{}".format(rt_id))
|
|
204
|
+
|
|
205
|
+
def list_route_tables(self, *, compartment_id: str,
|
|
206
|
+
**filters: Any) -> Response:
|
|
207
|
+
"""List route tables in a compartment."""
|
|
208
|
+
params = {"compartmentId": compartment_id}
|
|
209
|
+
params.update(_camel_params(filters))
|
|
210
|
+
return self._call(method="GET", path="/routeTables", params=params)
|
|
211
|
+
|
|
212
|
+
def create_security_list(self, *,
|
|
213
|
+
create_security_list_details: Any) -> Response:
|
|
214
|
+
"""Create a security list."""
|
|
215
|
+
return self._call(method="POST", path="/securityLists",
|
|
216
|
+
details=create_security_list_details)
|
|
217
|
+
|
|
218
|
+
def delete_security_list(self, *, security_list_id: str) -> Response:
|
|
219
|
+
"""Delete a security list."""
|
|
220
|
+
return self._call(
|
|
221
|
+
method="DELETE",
|
|
222
|
+
path="/securityLists/{}".format(security_list_id))
|
|
223
|
+
|
|
224
|
+
def list_security_lists(self, *, compartment_id: str,
|
|
225
|
+
**filters: Any) -> Response:
|
|
226
|
+
"""List security lists in a compartment."""
|
|
227
|
+
params = {"compartmentId": compartment_id}
|
|
228
|
+
params.update(_camel_params(filters))
|
|
229
|
+
return self._call(method="GET", path="/securityLists",
|
|
230
|
+
params=params)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class ComputeClient(_ServiceClient):
|
|
234
|
+
"""
|
|
235
|
+
The Core Services compute client.
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
SERVICE = "iaas"
|
|
239
|
+
API_VERSION = CORE_API_VERSION
|
|
240
|
+
|
|
241
|
+
def launch_instance(self, *, launch_instance_details: Any) -> Response:
|
|
242
|
+
"""Launch an instance."""
|
|
243
|
+
return self._call(method="POST", path="/instances",
|
|
244
|
+
details=launch_instance_details)
|
|
245
|
+
|
|
246
|
+
def terminate_instance(self, *, instance_id: str,
|
|
247
|
+
**options: Any) -> Response:
|
|
248
|
+
"""Terminate an instance."""
|
|
249
|
+
return self._call(method="DELETE",
|
|
250
|
+
path="/instances/{}".format(instance_id),
|
|
251
|
+
params=_camel_params(options))
|
|
252
|
+
|
|
253
|
+
def list_instances(self, *, compartment_id: str,
|
|
254
|
+
**filters: Any) -> Response:
|
|
255
|
+
"""List instances in a compartment."""
|
|
256
|
+
params = {"compartmentId": compartment_id}
|
|
257
|
+
params.update(_camel_params(filters))
|
|
258
|
+
return self._call(method="GET", path="/instances", params=params)
|
|
259
|
+
|
|
260
|
+
def list_images(self, *, compartment_id: str,
|
|
261
|
+
**filters: Any) -> Response:
|
|
262
|
+
"""List images in a compartment."""
|
|
263
|
+
params = {"compartmentId": compartment_id}
|
|
264
|
+
params.update(_camel_params(filters))
|
|
265
|
+
return self._call(method="GET", path="/images", params=params)
|
|
266
|
+
|
|
267
|
+
def attach_volume(self, *, attach_volume_details: Any) -> Response:
|
|
268
|
+
"""Attach a volume to an instance."""
|
|
269
|
+
return self._call(method="POST", path="/volumeAttachments",
|
|
270
|
+
details=attach_volume_details)
|
|
271
|
+
|
|
272
|
+
def list_volume_attachments(self, *, compartment_id: str,
|
|
273
|
+
**filters: Any) -> Response:
|
|
274
|
+
"""
|
|
275
|
+
List volume attachments in a compartment.
|
|
276
|
+
|
|
277
|
+
Narrow the listing with the SDK's filter keywords, e.g.
|
|
278
|
+
``instance_id=`` and / or ``volume_id=`` (also
|
|
279
|
+
``availability_domain=``, ``limit=``, ``page=``). Each
|
|
280
|
+
attachment carries ``instance_id``, ``volume_id`` and a
|
|
281
|
+
``lifecycle_state`` of ``ATTACHING``, ``ATTACHED``,
|
|
282
|
+
``DETACHING`` or ``DETACHED``, which is how a caller tells an
|
|
283
|
+
attach that is already in place from one that conflicts.
|
|
284
|
+
|
|
285
|
+
:param compartment_id: The compartment to list in.
|
|
286
|
+
:param filters: The snake_case filter keywords.
|
|
287
|
+
|
|
288
|
+
:returns: The :class:`Response`, whose ``data`` is the list of
|
|
289
|
+
attachments for this page.
|
|
290
|
+
"""
|
|
291
|
+
params = {"compartmentId": compartment_id}
|
|
292
|
+
params.update(_camel_params(filters))
|
|
293
|
+
rtnval = self._call(method="GET", path="/volumeAttachments",
|
|
294
|
+
params=params)
|
|
295
|
+
return rtnval
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class ComputeManagementClient(_ServiceClient):
|
|
299
|
+
"""
|
|
300
|
+
The Core Services compute-management client.
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
SERVICE = "iaas"
|
|
304
|
+
API_VERSION = CORE_API_VERSION
|
|
305
|
+
|
|
306
|
+
def create_instance_configuration(self, *,
|
|
307
|
+
create_instance_configuration: Any
|
|
308
|
+
) -> Response:
|
|
309
|
+
"""
|
|
310
|
+
Create an instance configuration.
|
|
311
|
+
|
|
312
|
+
The keyword lacks the ``_details`` suffix the sibling calls use;
|
|
313
|
+
that is the SDK's own inconsistency, reproduced here because
|
|
314
|
+
consumer code passes it.
|
|
315
|
+
"""
|
|
316
|
+
return self._call(method="POST", path="/instanceConfigurations",
|
|
317
|
+
details=create_instance_configuration)
|
|
318
|
+
|
|
319
|
+
def create_cluster_network(self, *,
|
|
320
|
+
create_cluster_network_details: Any
|
|
321
|
+
) -> Response:
|
|
322
|
+
"""Create a cluster network."""
|
|
323
|
+
return self._call(method="POST", path="/clusterNetworks",
|
|
324
|
+
details=create_cluster_network_details)
|
|
325
|
+
|
|
326
|
+
def terminate_cluster_network(self, *,
|
|
327
|
+
cluster_network_id: str) -> Response:
|
|
328
|
+
"""Terminate a cluster network."""
|
|
329
|
+
return self._call(
|
|
330
|
+
method="DELETE",
|
|
331
|
+
path="/clusterNetworks/{}".format(cluster_network_id))
|
|
332
|
+
|
|
333
|
+
def list_cluster_networks(self, *, compartment_id: str,
|
|
334
|
+
**filters: Any) -> Response:
|
|
335
|
+
"""List cluster networks in a compartment."""
|
|
336
|
+
params = {"compartmentId": compartment_id}
|
|
337
|
+
params.update(_camel_params(filters))
|
|
338
|
+
return self._call(method="GET", path="/clusterNetworks",
|
|
339
|
+
params=params)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class BlockstorageClient(_ServiceClient):
|
|
343
|
+
"""
|
|
344
|
+
The Core Services block-storage client.
|
|
345
|
+
"""
|
|
346
|
+
|
|
347
|
+
SERVICE = "iaas"
|
|
348
|
+
API_VERSION = CORE_API_VERSION
|
|
349
|
+
|
|
350
|
+
def create_volume(self, *, create_volume_details: Any) -> Response:
|
|
351
|
+
"""Create a block volume."""
|
|
352
|
+
return self._call(method="POST", path="/volumes",
|
|
353
|
+
details=create_volume_details)
|
|
354
|
+
|
|
355
|
+
def delete_volume(self, *, volume_id: str) -> Response:
|
|
356
|
+
"""Delete a block volume."""
|
|
357
|
+
return self._call(method="DELETE",
|
|
358
|
+
path="/volumes/{}".format(volume_id))
|
|
359
|
+
|
|
360
|
+
def list_volumes(self, *, compartment_id: str,
|
|
361
|
+
**filters: Any) -> Response:
|
|
362
|
+
"""List block volumes in a compartment."""
|
|
363
|
+
params = {"compartmentId": compartment_id}
|
|
364
|
+
params.update(_camel_params(filters))
|
|
365
|
+
return self._call(method="GET", path="/volumes", params=params)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class ObjectStorageClient(_ServiceClient):
|
|
369
|
+
"""
|
|
370
|
+
The Object Storage client.
|
|
371
|
+
|
|
372
|
+
Object Storage is not versioned in its path, unlike the other
|
|
373
|
+
services, so the version segment is empty.
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
SERVICE = "objectstorage"
|
|
377
|
+
API_VERSION = ""
|
|
378
|
+
|
|
379
|
+
def _url(self, path: str) -> str:
|
|
380
|
+
"""
|
|
381
|
+
Build an absolute URL without a version segment.
|
|
382
|
+
|
|
383
|
+
:param path: The path.
|
|
384
|
+
|
|
385
|
+
:returns: The absolute URL.
|
|
386
|
+
"""
|
|
387
|
+
rtnval = "{}{}".format(self._endpoint, path)
|
|
388
|
+
return rtnval
|
|
389
|
+
|
|
390
|
+
def get_namespace(self, **options: Any) -> Response:
|
|
391
|
+
"""Return the tenancy's Object Storage namespace."""
|
|
392
|
+
return self._call(method="GET", path="/n/",
|
|
393
|
+
params=_camel_params(options))
|
|
394
|
+
|
|
395
|
+
def create_bucket(self, *, namespace_name: str,
|
|
396
|
+
create_bucket_details: Any) -> Response:
|
|
397
|
+
"""Create a bucket."""
|
|
398
|
+
return self._call(method="POST",
|
|
399
|
+
path="/n/{}/b/".format(namespace_name),
|
|
400
|
+
details=create_bucket_details)
|
|
401
|
+
|
|
402
|
+
def get_bucket(self, *, namespace_name: str,
|
|
403
|
+
bucket_name: str) -> Response:
|
|
404
|
+
"""Fetch a bucket."""
|
|
405
|
+
return self._call(
|
|
406
|
+
method="GET",
|
|
407
|
+
path="/n/{}/b/{}/".format(namespace_name, bucket_name))
|
|
408
|
+
|
|
409
|
+
def delete_bucket(self, *, namespace_name: str,
|
|
410
|
+
bucket_name: str) -> Response:
|
|
411
|
+
"""Delete a bucket."""
|
|
412
|
+
return self._call(
|
|
413
|
+
method="DELETE",
|
|
414
|
+
path="/n/{}/b/{}/".format(namespace_name, bucket_name))
|
|
415
|
+
|
|
416
|
+
def list_buckets(self, *, namespace_name: str, compartment_id: str,
|
|
417
|
+
**filters: Any) -> Response:
|
|
418
|
+
"""List buckets in a compartment."""
|
|
419
|
+
params = {"compartmentId": compartment_id}
|
|
420
|
+
params.update(_camel_params(filters))
|
|
421
|
+
return self._call(method="GET",
|
|
422
|
+
path="/n/{}/b/".format(namespace_name),
|
|
423
|
+
params=params)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class DnsClient(_ServiceClient):
|
|
427
|
+
"""
|
|
428
|
+
The DNS client.
|
|
429
|
+
"""
|
|
430
|
+
|
|
431
|
+
SERVICE = "dns"
|
|
432
|
+
API_VERSION = DNS_API_VERSION
|
|
433
|
+
|
|
434
|
+
def update_rr_set(self, *, zone_name_or_id: str, domain: str,
|
|
435
|
+
rtype: str, update_rr_set_details: Any,
|
|
436
|
+
**options: Any) -> Response:
|
|
437
|
+
"""Replace a record set."""
|
|
438
|
+
return self._call(
|
|
439
|
+
method="PUT",
|
|
440
|
+
path="/zones/{}/records/{}/{}".format(zone_name_or_id, domain,
|
|
441
|
+
rtype),
|
|
442
|
+
params=_camel_params(options),
|
|
443
|
+
details=update_rr_set_details)
|
|
444
|
+
|
|
445
|
+
def delete_rr_set(self, *, zone_name_or_id: str, domain: str,
|
|
446
|
+
rtype: str, **options: Any) -> Response:
|
|
447
|
+
"""Delete a record set."""
|
|
448
|
+
return self._call(
|
|
449
|
+
method="DELETE",
|
|
450
|
+
path="/zones/{}/records/{}/{}".format(zone_name_or_id, domain,
|
|
451
|
+
rtype),
|
|
452
|
+
params=_camel_params(options))
|
|
453
|
+
|
|
454
|
+
def list_zones(self, *, compartment_id: str,
|
|
455
|
+
**filters: Any) -> Response:
|
|
456
|
+
"""List DNS zones in a compartment."""
|
|
457
|
+
params = {"compartmentId": compartment_id}
|
|
458
|
+
params.update(_camel_params(filters))
|
|
459
|
+
return self._call(method="GET", path="/zones", params=params)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
class FileStorageClient(_ServiceClient):
|
|
463
|
+
"""
|
|
464
|
+
The File Storage client.
|
|
465
|
+
"""
|
|
466
|
+
|
|
467
|
+
SERVICE = "filestorage"
|
|
468
|
+
API_VERSION = FILE_STORAGE_API_VERSION
|
|
469
|
+
|
|
470
|
+
def get_file_system(self, *, file_system_id: str) -> Response:
|
|
471
|
+
"""Fetch a file system."""
|
|
472
|
+
return self._call(
|
|
473
|
+
method="GET", path="/fileSystems/{}".format(file_system_id))
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def _camel_params(values: Dict[str, Any]) -> Dict[str, Any]:
|
|
477
|
+
"""
|
|
478
|
+
Render filter keywords as the camelCase query parameters OCI expects.
|
|
479
|
+
|
|
480
|
+
:param values: The snake_case keywords.
|
|
481
|
+
|
|
482
|
+
:returns: The camelCase parameters.
|
|
483
|
+
"""
|
|
484
|
+
from ccai.restclient.oracle.ocimodels import to_camel
|
|
485
|
+
|
|
486
|
+
rtnval = {to_camel(name): value for name, value in values.items()}
|
|
487
|
+
return rtnval
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
def build_clients(*, transport: Any, region: str,
|
|
491
|
+
domain: str = "oraclecloud.com") -> Dict[str, Any]:
|
|
492
|
+
"""
|
|
493
|
+
Build every service client over one transport.
|
|
494
|
+
|
|
495
|
+
:param transport: The shared :class:`OciTransport`.
|
|
496
|
+
:param region: The region identifier.
|
|
497
|
+
:param domain: The realm domain.
|
|
498
|
+
|
|
499
|
+
:returns: A dict keyed the way the venue's session factory keyed it.
|
|
500
|
+
"""
|
|
501
|
+
kwargs = {"transport": transport, "region": region, "domain": domain}
|
|
502
|
+
|
|
503
|
+
rtnval = {
|
|
504
|
+
"virtual_network": VirtualNetworkClient(**kwargs),
|
|
505
|
+
"compute": ComputeClient(**kwargs),
|
|
506
|
+
"compute_management": ComputeManagementClient(**kwargs),
|
|
507
|
+
"blockstorage": BlockstorageClient(**kwargs),
|
|
508
|
+
"object_storage": ObjectStorageClient(**kwargs),
|
|
509
|
+
"dns": DnsClient(**kwargs),
|
|
510
|
+
"file_storage": FileStorageClient(**kwargs),
|
|
511
|
+
}
|
|
512
|
+
return rtnval
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. module:: ocierror
|
|
3
|
+
:platform: Darwin, Linux, Unix, Windows
|
|
4
|
+
:synopsis: Errors raised for non-success OCI responses.
|
|
5
|
+
|
|
6
|
+
:class:`ServiceError` keeps the name ``oci.exceptions`` used, and the same
|
|
7
|
+
``status`` / ``code`` / ``message`` attributes, because consumer code
|
|
8
|
+
catches it and branches on those — ``BucketNotEmpty`` and ``NotAuthorized``
|
|
9
|
+
need different handling, and a teardown that treated them alike would
|
|
10
|
+
either leak storage or mask a permissions problem.
|
|
11
|
+
|
|
12
|
+
.. moduleauthor:: Myron Walker <myron.walker@gmail.com>
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
__author__ = "Myron Walker"
|
|
16
|
+
__copyright__ = "Copyright 2026, Code Craft AI LLC"
|
|
17
|
+
__credits__ = []
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from typing import Optional
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ServiceError(Exception):
|
|
24
|
+
"""
|
|
25
|
+
Raised when an OCI service returns a non-success status.
|
|
26
|
+
|
|
27
|
+
:ivar status: The HTTP status code.
|
|
28
|
+
:ivar code: The OCI error code, e.g. ``BucketNotEmpty``.
|
|
29
|
+
:ivar message: The OCI error message.
|
|
30
|
+
:ivar body: The raw response body text.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self, message_text: str, *, status: int = 0,
|
|
34
|
+
code: str = "", message: str = "",
|
|
35
|
+
body: Optional[str] = None) -> None:
|
|
36
|
+
"""
|
|
37
|
+
Construct a ServiceError.
|
|
38
|
+
|
|
39
|
+
:param message_text: The human-readable error message.
|
|
40
|
+
:param status: The HTTP status code.
|
|
41
|
+
:param code: The OCI error code.
|
|
42
|
+
:param message: The OCI error message.
|
|
43
|
+
:param body: The raw response body.
|
|
44
|
+
"""
|
|
45
|
+
super().__init__(message_text)
|
|
46
|
+
self.status: int = status
|
|
47
|
+
self.code: str = code
|
|
48
|
+
self.message: str = message
|
|
49
|
+
self.body: Optional[str] = body
|
|
50
|
+
return
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class TransientServiceError(ServiceError):
|
|
54
|
+
"""
|
|
55
|
+
Raised for a throttle or a server fault.
|
|
56
|
+
|
|
57
|
+
Separate from :class:`ServiceError` because these are worth retrying
|
|
58
|
+
and a 4xx is not; conflating them would retry a bad request forever.
|
|
59
|
+
"""
|