borneo 5.4.2__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.
borneo/__init__.py ADDED
@@ -0,0 +1,132 @@
1
+ #
2
+ # Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # https://oss.oracle.com/licenses/upl/
6
+ #
7
+
8
+ # This environment variable suppresses the import of all services
9
+ # when importing from the OCI SDK. It can greatly speed up
10
+ # program startup
11
+ import os
12
+
13
+ os.environ['OCI_PYTHON_SDK_NO_SERVICE_IMPORTS'] = '1'
14
+
15
+ from . import iam
16
+ from . import kv
17
+ from .auth import AuthorizationProvider
18
+ from .common import (
19
+ Consistency, Durability, FieldRange, PutOption, Replica, ReplicaStats,
20
+ ResourcePrincipalClaimKeys, State, SystemState, TableLimits, TableUsage,
21
+ TimeToLive, TimeUnit, UserInfo, Version, IndexInfo, PreparedStatement)
22
+ from .config import (
23
+ DefaultRetryHandler, NoSQLHandleConfig, Region, Regions, RetryHandler,
24
+ StatsProfile)
25
+ from .driver import NoSQLHandle
26
+ from .exception import (
27
+ BatchOperationNumberLimitException, IllegalArgumentException,
28
+ IllegalStateException, IndexExistsException, IndexNotFoundException,
29
+ InvalidAuthorizationException, NoSQLException,
30
+ OperationNotSupportedException, OperationThrottlingException,
31
+ ReadThrottlingException, RequestSizeLimitException, RequestTimeoutException,
32
+ ResourceExistsException, ResourceNotFoundException, RetryableException,
33
+ SecurityInfoNotReadyException, SystemException, TableExistsException,
34
+ TableNotFoundException, TableNotReadyException, ThrottlingException,
35
+ UnsupportedQueryVersionException, WriteThrottlingException)
36
+ from .operations import (
37
+ AddReplicaRequest, DeleteRequest, DeleteResult, DropReplicaRequest,
38
+ GetIndexesRequest, GetIndexesResult, GetRequest,
39
+ GetResult, GetTableRequest, ListTablesRequest, ListTablesResult,
40
+ MultiDeleteRequest, MultiDeleteResult, OperationResult, PrepareRequest,
41
+ PrepareResult, PutRequest, PutResult, QueryRequest, QueryIterableResult,
42
+ QueryResult, ReplicaStatsRequest, ReplicaStatsResult, Request, Result,
43
+ SystemRequest, SystemResult,
44
+ SystemStatusRequest, TableRequest, TableResult, TableUsageRequest,
45
+ TableUsageResult, WriteMultipleRequest, WriteMultipleResult)
46
+ from .stats import (StatsControl)
47
+ from .version import __version__
48
+
49
+ __all__ = ['AddReplicaRequest',
50
+ 'AuthorizationProvider',
51
+ 'BatchOperationNumberLimitException',
52
+ 'Consistency',
53
+ 'Durability',
54
+ 'DefaultRetryHandler',
55
+ 'DeleteRequest',
56
+ 'DeleteResult',
57
+ 'DropReplicaRequest',
58
+ 'FieldRange',
59
+ 'GetIndexesRequest',
60
+ 'GetIndexesResult',
61
+ 'GetRequest',
62
+ 'GetResult',
63
+ 'GetTableRequest',
64
+ 'IllegalArgumentException',
65
+ 'IllegalStateException',
66
+ 'IndexExistsException',
67
+ 'IndexInfo',
68
+ 'IndexNotFoundException',
69
+ 'InvalidAuthorizationException',
70
+ 'ListTablesRequest',
71
+ 'ListTablesResult',
72
+ 'MultiDeleteRequest',
73
+ 'MultiDeleteResult',
74
+ 'NoSQLException',
75
+ 'NoSQLHandle',
76
+ 'NoSQLHandleConfig',
77
+ 'OperationNotSupportedException',
78
+ 'OperationResult',
79
+ 'OperationThrottlingException',
80
+ 'PreparedStatement',
81
+ 'PrepareRequest',
82
+ 'PrepareResult',
83
+ 'PutOption',
84
+ 'PutRequest',
85
+ 'PutResult',
86
+ 'QueryRequest',
87
+ 'QueryResult',
88
+ 'QueryIterableResult',
89
+ 'ReadThrottlingException',
90
+ 'Region',
91
+ 'Regions',
92
+ 'Replica',
93
+ 'ReplicaStats',
94
+ 'ReplicaStatsRequest',
95
+ 'ReplicaStatsResult',
96
+ 'Request',
97
+ 'RequestSizeLimitException',
98
+ 'RequestTimeoutException',
99
+ 'ResourceExistsException',
100
+ 'ResourcePrincipalClaimKeys',
101
+ 'ResourceNotFoundException',
102
+ 'Result',
103
+ 'RetryHandler',
104
+ 'RetryableException',
105
+ 'SecurityInfoNotReadyException',
106
+ 'State',
107
+ "StatsControl",
108
+ 'StatsProfile',
109
+ 'SystemException',
110
+ 'SystemRequest',
111
+ 'SystemResult',
112
+ 'SystemState',
113
+ 'SystemStatusRequest',
114
+ 'TableExistsException',
115
+ 'TableLimits',
116
+ 'TableNotFoundException',
117
+ 'TableNotReadyException',
118
+ 'TableRequest',
119
+ 'TableResult',
120
+ 'TableUsage',
121
+ 'TableUsageRequest',
122
+ 'TableUsageResult',
123
+ 'ThrottlingException',
124
+ 'TimeToLive',
125
+ 'TimeUnit',
126
+ 'UnsupportedQueryVersionException',
127
+ 'UserInfo',
128
+ 'Version',
129
+ 'WriteMultipleRequest',
130
+ 'WriteMultipleResult',
131
+ 'WriteThrottlingException'
132
+ ]
borneo/auth.py ADDED
@@ -0,0 +1,100 @@
1
+ #
2
+ # Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # https://oss.oracle.com/licenses/upl/
6
+ #
7
+
8
+ from abc import ABCMeta, abstractmethod
9
+
10
+ from .common import CheckValue, HttpConstants
11
+ from .exception import IllegalArgumentException
12
+
13
+
14
+ class AuthorizationProvider(object):
15
+ """
16
+ AuthorizationProvider is a callback interface used by the driver to obtain
17
+ an authorization string for a request. It is called when an authorization
18
+ string is required. In general applications need not implement this
19
+ interface, instead using the default mechanisms.
20
+
21
+ Instances of this interface must be reentrant and thread-safe.
22
+ """
23
+ __metaclass__ = ABCMeta
24
+
25
+ @abstractmethod
26
+ def close(self):
27
+ """
28
+ Closes the authorization provider and releases any resources it
29
+ may be using.
30
+ """
31
+ pass
32
+
33
+ @abstractmethod
34
+ def get_authorization_string(self, request=None):
35
+ """
36
+ Returns an authorization string for the specified request. The string is
37
+ sent to the server in the request and is used for authorization.
38
+ Authorization information can be request-dependent.
39
+
40
+ :param request: the request to be issued. This is an
41
+ instance of :py:meth:`Request`.
42
+ :type request: Request
43
+ :returns: a string indicating that the application is authorized to
44
+ perform the request.
45
+ :rtype: str
46
+ """
47
+ pass
48
+
49
+ def set_logger(self, logger):
50
+ """
51
+ Sets a logger instance for this provider. If not set, the logger
52
+ associated with the driver is used.
53
+
54
+ :param logger: the logger to use.
55
+ :type logger: Logger
56
+ :returns: self.
57
+ :raises IllegalArgumentException: raises the exception if logger is not
58
+ an instance of Logger.
59
+ """
60
+ return self
61
+
62
+ def get_logger(self):
63
+ """
64
+ Returns the logger of this provider if set, None if not.
65
+
66
+ :returns: the logger.
67
+ :rtype: Logger or None
68
+ """
69
+ pass
70
+
71
+ def validate_auth_string(self, auth_string):
72
+ """
73
+ Validates the authentication string. This method is optional and by
74
+ default it just allows a non-none string.
75
+
76
+ :param auth_string: the auth string to be validated.
77
+ :type auth_string: str
78
+ :raises IllegalArgumentException: raises the exception if input is not
79
+ a string or none.
80
+ """
81
+ if not CheckValue.is_str(auth_string):
82
+ raise IllegalArgumentException(
83
+ 'Configured AuthorizationProvider requires a non-none string.')
84
+
85
+ def set_required_headers(self, request, auth_string, headers,
86
+ content = None):
87
+ """
88
+ Internal use only.
89
+
90
+ Set HTTP headers required by the provider.
91
+
92
+ :param request: the request being processed.
93
+ :type request: Request
94
+ :param auth_string: the auth string.
95
+ :type auth_string: str
96
+ :param headers: the HTTP headers.
97
+ :type headers: dict
98
+ """
99
+ if auth_string is not None:
100
+ headers[HttpConstants.AUTHORIZATION] = auth_string