couchbase-connect-py 0.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.
- couchbase_connect/__init__.py +92 -0
- couchbase_connect/auto.py +54 -0
- couchbase_connect/base.py +1058 -0
- couchbase_connect/capella/__init__.py +152 -0
- couchbase_connect/capella/allowed_cidr.py +140 -0
- couchbase_connect/capella/bucket.py +175 -0
- couchbase_connect/capella/certificate.py +74 -0
- couchbase_connect/capella/client.py +117 -0
- couchbase_connect/capella/cluster.py +511 -0
- couchbase_connect/capella/connect.py +161 -0
- couchbase_connect/capella/connectivity.py +185 -0
- couchbase_connect/capella/credentials.py +217 -0
- couchbase_connect/capella/exceptions.py +37 -0
- couchbase_connect/capella/models.py +436 -0
- couchbase_connect/capella/organization.py +157 -0
- couchbase_connect/capella/project.py +251 -0
- couchbase_connect/capella/user.py +152 -0
- couchbase_connect/capella/utils.py +375 -0
- couchbase_connect/cli.py +324 -0
- couchbase_connect/cloud.py +334 -0
- couchbase_connect/cluster_create.py +512 -0
- couchbase_connect/config.py +427 -0
- couchbase_connect/enums.py +33 -0
- couchbase_connect/exceptions.py +19 -0
- couchbase_connect/models.py +110 -0
- couchbase_connect/protocol.py +236 -0
- couchbase_connect/retry.py +96 -0
- couchbase_connect/server.py +203 -0
- couchbase_connect/stream.py +141 -0
- couchbase_connect_py-0.2.0.dist-info/METADATA +92 -0
- couchbase_connect_py-0.2.0.dist-info/RECORD +34 -0
- couchbase_connect_py-0.2.0.dist-info/WHEEL +4 -0
- couchbase_connect_py-0.2.0.dist-info/entry_points.txt +2 -0
- couchbase_connect_py-0.2.0.dist-info/licenses/LICENSE.txt +202 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Couchbase Server and Capella connection helpers."""
|
|
2
|
+
|
|
3
|
+
from couchbase_connect.auto import AutoCouchbaseConnect, IllegalStateError
|
|
4
|
+
from couchbase_connect.capella import (
|
|
5
|
+
CapellaAllowedCIDR,
|
|
6
|
+
CapellaAPIError,
|
|
7
|
+
CapellaBucket,
|
|
8
|
+
CapellaCertificate,
|
|
9
|
+
CapellaCluster,
|
|
10
|
+
CapellaConnectivity,
|
|
11
|
+
CapellaCredentials,
|
|
12
|
+
CapellaNotFoundError,
|
|
13
|
+
CapellaOrganization,
|
|
14
|
+
CapellaProject,
|
|
15
|
+
CapellaUser,
|
|
16
|
+
CouchbaseCapella,
|
|
17
|
+
UserNotConfiguredError,
|
|
18
|
+
connect_cluster,
|
|
19
|
+
disconnect_cluster,
|
|
20
|
+
)
|
|
21
|
+
from couchbase_connect.cloud import Capella
|
|
22
|
+
from couchbase_connect.config import (
|
|
23
|
+
CouchbaseConfig,
|
|
24
|
+
convert_bucket_type,
|
|
25
|
+
convert_conflict_resolution_type,
|
|
26
|
+
convert_storage_backend,
|
|
27
|
+
)
|
|
28
|
+
from couchbase_connect.models import (
|
|
29
|
+
BucketData,
|
|
30
|
+
CapellaNodeConfig,
|
|
31
|
+
ClusterNodeConfig,
|
|
32
|
+
CollectionData,
|
|
33
|
+
GroupData,
|
|
34
|
+
IndexData,
|
|
35
|
+
RoleData,
|
|
36
|
+
ScopeData,
|
|
37
|
+
SearchIndexData,
|
|
38
|
+
TableData,
|
|
39
|
+
UserData,
|
|
40
|
+
)
|
|
41
|
+
from couchbase_connect.protocol import (
|
|
42
|
+
CouchbaseConnect,
|
|
43
|
+
get_instance,
|
|
44
|
+
open_connection,
|
|
45
|
+
resolve,
|
|
46
|
+
)
|
|
47
|
+
from couchbase_connect.server import Server
|
|
48
|
+
from couchbase_connect.stream import CouchbaseStream
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
"AutoCouchbaseConnect",
|
|
52
|
+
"BucketData",
|
|
53
|
+
"Capella",
|
|
54
|
+
"CapellaAPIError",
|
|
55
|
+
"CapellaAllowedCIDR",
|
|
56
|
+
"CapellaBucket",
|
|
57
|
+
"CapellaCertificate",
|
|
58
|
+
"CapellaCluster",
|
|
59
|
+
"CapellaConnectivity",
|
|
60
|
+
"CapellaCredentials",
|
|
61
|
+
"CapellaNodeConfig",
|
|
62
|
+
"CapellaNotFoundError",
|
|
63
|
+
"CapellaOrganization",
|
|
64
|
+
"CapellaProject",
|
|
65
|
+
"CapellaUser",
|
|
66
|
+
"ClusterNodeConfig",
|
|
67
|
+
"CollectionData",
|
|
68
|
+
"CouchbaseCapella",
|
|
69
|
+
"CouchbaseConfig",
|
|
70
|
+
"CouchbaseConnect",
|
|
71
|
+
"CouchbaseStream",
|
|
72
|
+
"GroupData",
|
|
73
|
+
"IllegalStateError",
|
|
74
|
+
"IndexData",
|
|
75
|
+
"RoleData",
|
|
76
|
+
"ScopeData",
|
|
77
|
+
"SearchIndexData",
|
|
78
|
+
"Server",
|
|
79
|
+
"TableData",
|
|
80
|
+
"UserData",
|
|
81
|
+
"UserNotConfiguredError",
|
|
82
|
+
"connect_cluster",
|
|
83
|
+
"convert_bucket_type",
|
|
84
|
+
"convert_conflict_resolution_type",
|
|
85
|
+
"convert_storage_backend",
|
|
86
|
+
"disconnect_cluster",
|
|
87
|
+
"get_instance",
|
|
88
|
+
"open_connection",
|
|
89
|
+
"resolve",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
__version__ = "0.2.0"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Facade that routes to Server or Capella based on CouchbaseConfig."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Mapping, Optional
|
|
6
|
+
|
|
7
|
+
from couchbase_connect.config import CouchbaseConfig
|
|
8
|
+
from couchbase_connect.protocol import CouchbaseConnect, resolve
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AutoCouchbaseConnect:
|
|
12
|
+
|
|
13
|
+
_instance: Optional["AutoCouchbaseConnect"] = None
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
self._delegate: Optional[CouchbaseConnect] = None
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def get_instance(cls) -> "AutoCouchbaseConnect":
|
|
20
|
+
if cls._instance is None:
|
|
21
|
+
cls._instance = cls()
|
|
22
|
+
assert cls._instance is not None
|
|
23
|
+
return cls._instance
|
|
24
|
+
|
|
25
|
+
def _require_delegate(self) -> CouchbaseConnect:
|
|
26
|
+
if self._delegate is None:
|
|
27
|
+
raise IllegalStateError(
|
|
28
|
+
"Call connect(CouchbaseConfig) or create_cluster(CouchbaseConfig) first"
|
|
29
|
+
)
|
|
30
|
+
return self._delegate
|
|
31
|
+
|
|
32
|
+
def _assign_delegate(self, config: CouchbaseConfig) -> None:
|
|
33
|
+
self._delegate = resolve(config)
|
|
34
|
+
|
|
35
|
+
def connect(self, config: CouchbaseConfig) -> None:
|
|
36
|
+
self._assign_delegate(config)
|
|
37
|
+
assert self._delegate is not None
|
|
38
|
+
self._delegate.connect(config)
|
|
39
|
+
|
|
40
|
+
def create_cluster(
|
|
41
|
+
self,
|
|
42
|
+
config: CouchbaseConfig,
|
|
43
|
+
options: Optional[Mapping[str, str]] = None,
|
|
44
|
+
) -> None:
|
|
45
|
+
self._assign_delegate(config)
|
|
46
|
+
assert self._delegate is not None
|
|
47
|
+
self._delegate.create_cluster(config, options)
|
|
48
|
+
|
|
49
|
+
def __getattr__(self, name: str) -> Any:
|
|
50
|
+
return getattr(self._require_delegate(), name)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class IllegalStateError(RuntimeError):
|
|
54
|
+
pass
|