google-cloud-memorystore 0.1.3__tar.gz → 0.3.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.
- {google_cloud_memorystore-0.1.3/google_cloud_memorystore.egg-info → google_cloud_memorystore-0.3.0}/PKG-INFO +17 -3
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/README.rst +1 -1
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore/__init__.py +2 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore/gapic_version.py +1 -1
- google_cloud_memorystore-0.3.0/google/cloud/memorystore_v1/__init__.py +207 -0
- {google_cloud_memorystore-0.1.3/google/cloud/memorystore_v1beta → google_cloud_memorystore-0.3.0/google/cloud/memorystore_v1}/gapic_version.py +1 -1
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/client.py +64 -20
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/transports/base.py +3 -2
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/transports/rest.py +3 -2
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/types/__init__.py +2 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/types/memorystore.py +224 -10
- google_cloud_memorystore-0.3.0/google/cloud/memorystore_v1beta/__init__.py +167 -0
- {google_cloud_memorystore-0.1.3/google/cloud/memorystore_v1 → google_cloud_memorystore-0.3.0/google/cloud/memorystore_v1beta}/gapic_version.py +1 -1
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/client.py +38 -20
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/transports/base.py +3 -2
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/transports/rest.py +3 -2
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/types/memorystore.py +5 -5
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0/google_cloud_memorystore.egg-info}/PKG-INFO +17 -3
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google_cloud_memorystore.egg-info/requires.txt +4 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/setup.py +3 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/gapic/memorystore_v1/test_memorystore.py +351 -63
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/gapic/memorystore_v1beta/test_memorystore.py +225 -29
- google_cloud_memorystore-0.1.3/google/cloud/memorystore_v1/__init__.py +0 -101
- google_cloud_memorystore-0.1.3/google/cloud/memorystore_v1beta/__init__.py +0 -63
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/LICENSE +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/MANIFEST.in +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore/py.typed +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/gapic_metadata.json +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/py.typed +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/pagers.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/transports/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1/services/memorystore/transports/rest_base.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/gapic_metadata.json +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/py.typed +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/pagers.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/transports/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/services/memorystore/transports/rest_base.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google/cloud/memorystore_v1beta/types/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google_cloud_memorystore.egg-info/SOURCES.txt +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google_cloud_memorystore.egg-info/dependency_links.txt +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google_cloud_memorystore.egg-info/not-zip-safe +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/google_cloud_memorystore.egg-info/top_level.txt +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/setup.cfg +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/gapic/memorystore_v1/__init__.py +0 -0
- {google_cloud_memorystore-0.1.3 → google_cloud_memorystore-0.3.0}/tests/unit/gapic/memorystore_v1beta/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-memorystore
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Google Cloud Memorystore API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-memorystore
|
|
6
6
|
Author: Google LLC
|
|
@@ -19,15 +19,29 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
23
|
Classifier: Operating System :: OS Independent
|
|
23
24
|
Classifier: Topic :: Internet
|
|
24
25
|
Requires-Python: >=3.7
|
|
25
26
|
License-File: LICENSE
|
|
26
27
|
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.1
|
|
27
28
|
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
29
|
+
Requires-Dist: grpcio<2.0.0,>=1.33.2
|
|
30
|
+
Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
|
|
28
31
|
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
29
32
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
30
33
|
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: home-page
|
|
39
|
+
Dynamic: license
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
Dynamic: platform
|
|
42
|
+
Dynamic: requires-dist
|
|
43
|
+
Dynamic: requires-python
|
|
44
|
+
Dynamic: summary
|
|
31
45
|
|
|
32
46
|
Python Client for Memorystore
|
|
33
47
|
=============================
|
|
@@ -92,7 +106,7 @@ Supported Python Versions
|
|
|
92
106
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
93
107
|
Python.
|
|
94
108
|
|
|
95
|
-
Python >= 3.7
|
|
109
|
+
Python >= 3.7, including 3.14
|
|
96
110
|
|
|
97
111
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
98
112
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
@@ -61,7 +61,7 @@ Supported Python Versions
|
|
|
61
61
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
62
62
|
Python.
|
|
63
63
|
|
|
64
|
-
Python >= 3.7
|
|
64
|
+
Python >= 3.7, including 3.14
|
|
65
65
|
|
|
66
66
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
67
67
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
@@ -32,6 +32,7 @@ from google.cloud.memorystore_v1.types.memorystore import (
|
|
|
32
32
|
DeleteBackupRequest,
|
|
33
33
|
DeleteInstanceRequest,
|
|
34
34
|
DiscoveryEndpoint,
|
|
35
|
+
EncryptionInfo,
|
|
35
36
|
ExportBackupRequest,
|
|
36
37
|
GetBackupCollectionRequest,
|
|
37
38
|
GetBackupRequest,
|
|
@@ -72,6 +73,7 @@ __all__ = (
|
|
|
72
73
|
"DeleteBackupRequest",
|
|
73
74
|
"DeleteInstanceRequest",
|
|
74
75
|
"DiscoveryEndpoint",
|
|
76
|
+
"EncryptionInfo",
|
|
75
77
|
"ExportBackupRequest",
|
|
76
78
|
"GetBackupCollectionRequest",
|
|
77
79
|
"GetBackupRequest",
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
import sys
|
|
17
|
+
|
|
18
|
+
import google.api_core as api_core
|
|
19
|
+
|
|
20
|
+
from google.cloud.memorystore_v1 import gapic_version as package_version
|
|
21
|
+
|
|
22
|
+
__version__ = package_version.__version__
|
|
23
|
+
|
|
24
|
+
if sys.version_info >= (3, 8): # pragma: NO COVER
|
|
25
|
+
from importlib import metadata
|
|
26
|
+
else: # pragma: NO COVER
|
|
27
|
+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
28
|
+
# this code path once we drop support for Python 3.7
|
|
29
|
+
import importlib_metadata as metadata
|
|
30
|
+
|
|
31
|
+
from .services.memorystore import MemorystoreClient
|
|
32
|
+
from .types.memorystore import (
|
|
33
|
+
AutomatedBackupConfig,
|
|
34
|
+
Backup,
|
|
35
|
+
BackupCollection,
|
|
36
|
+
BackupFile,
|
|
37
|
+
BackupInstanceRequest,
|
|
38
|
+
CertificateAuthority,
|
|
39
|
+
ConnectionType,
|
|
40
|
+
CreateInstanceRequest,
|
|
41
|
+
CrossInstanceReplicationConfig,
|
|
42
|
+
DeleteBackupRequest,
|
|
43
|
+
DeleteInstanceRequest,
|
|
44
|
+
DiscoveryEndpoint,
|
|
45
|
+
EncryptionInfo,
|
|
46
|
+
ExportBackupRequest,
|
|
47
|
+
GetBackupCollectionRequest,
|
|
48
|
+
GetBackupRequest,
|
|
49
|
+
GetCertificateAuthorityRequest,
|
|
50
|
+
GetInstanceRequest,
|
|
51
|
+
Instance,
|
|
52
|
+
ListBackupCollectionsRequest,
|
|
53
|
+
ListBackupCollectionsResponse,
|
|
54
|
+
ListBackupsRequest,
|
|
55
|
+
ListBackupsResponse,
|
|
56
|
+
ListInstancesRequest,
|
|
57
|
+
ListInstancesResponse,
|
|
58
|
+
MaintenancePolicy,
|
|
59
|
+
MaintenanceSchedule,
|
|
60
|
+
NodeConfig,
|
|
61
|
+
OperationMetadata,
|
|
62
|
+
PersistenceConfig,
|
|
63
|
+
PscAttachmentDetail,
|
|
64
|
+
PscAutoConnection,
|
|
65
|
+
PscConnection,
|
|
66
|
+
PscConnectionStatus,
|
|
67
|
+
RescheduleMaintenanceRequest,
|
|
68
|
+
UpdateInstanceRequest,
|
|
69
|
+
WeeklyMaintenanceWindow,
|
|
70
|
+
ZoneDistributionConfig,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if hasattr(api_core, "check_python_version") and hasattr(
|
|
74
|
+
api_core, "check_dependency_versions"
|
|
75
|
+
): # pragma: NO COVER
|
|
76
|
+
api_core.check_python_version("google.cloud.memorystore_v1") # type: ignore
|
|
77
|
+
api_core.check_dependency_versions("google.cloud.memorystore_v1") # type: ignore
|
|
78
|
+
else: # pragma: NO COVER
|
|
79
|
+
# An older version of api_core is installed which does not define the
|
|
80
|
+
# functions above. We do equivalent checks manually.
|
|
81
|
+
try:
|
|
82
|
+
import sys
|
|
83
|
+
import warnings
|
|
84
|
+
|
|
85
|
+
_py_version_str = sys.version.split()[0]
|
|
86
|
+
_package_label = "google.cloud.memorystore_v1"
|
|
87
|
+
if sys.version_info < (3, 9):
|
|
88
|
+
warnings.warn(
|
|
89
|
+
"You are using a non-supported Python version "
|
|
90
|
+
+ f"({_py_version_str}). Google will not post any further "
|
|
91
|
+
+ f"updates to {_package_label} supporting this Python version. "
|
|
92
|
+
+ "Please upgrade to the latest Python version, or at "
|
|
93
|
+
+ f"least to Python 3.9, and then update {_package_label}.",
|
|
94
|
+
FutureWarning,
|
|
95
|
+
)
|
|
96
|
+
if sys.version_info[:2] == (3, 9):
|
|
97
|
+
warnings.warn(
|
|
98
|
+
f"You are using a Python version ({_py_version_str}) "
|
|
99
|
+
+ f"which Google will stop supporting in {_package_label} in "
|
|
100
|
+
+ "January 2026. Please "
|
|
101
|
+
+ "upgrade to the latest Python version, or at "
|
|
102
|
+
+ "least to Python 3.10, before then, and "
|
|
103
|
+
+ f"then update {_package_label}.",
|
|
104
|
+
FutureWarning,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def parse_version_to_tuple(version_string: str):
|
|
108
|
+
"""Safely converts a semantic version string to a comparable tuple of integers.
|
|
109
|
+
Example: "4.25.8" -> (4, 25, 8)
|
|
110
|
+
Ignores non-numeric parts and handles common version formats.
|
|
111
|
+
Args:
|
|
112
|
+
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
|
|
113
|
+
Returns:
|
|
114
|
+
Tuple of integers for the parsed version string.
|
|
115
|
+
"""
|
|
116
|
+
parts = []
|
|
117
|
+
for part in version_string.split("."):
|
|
118
|
+
try:
|
|
119
|
+
parts.append(int(part))
|
|
120
|
+
except ValueError:
|
|
121
|
+
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
|
|
122
|
+
# This is a simplification compared to 'packaging.parse_version', but sufficient
|
|
123
|
+
# for comparing strictly numeric semantic versions.
|
|
124
|
+
break
|
|
125
|
+
return tuple(parts)
|
|
126
|
+
|
|
127
|
+
def _get_version(dependency_name):
|
|
128
|
+
try:
|
|
129
|
+
version_string: str = metadata.version(dependency_name)
|
|
130
|
+
parsed_version = parse_version_to_tuple(version_string)
|
|
131
|
+
return (parsed_version, version_string)
|
|
132
|
+
except Exception:
|
|
133
|
+
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
|
|
134
|
+
# or errors during parse_version_to_tuple
|
|
135
|
+
return (None, "--")
|
|
136
|
+
|
|
137
|
+
_dependency_package = "google.protobuf"
|
|
138
|
+
_next_supported_version = "4.25.8"
|
|
139
|
+
_next_supported_version_tuple = (4, 25, 8)
|
|
140
|
+
_recommendation = " (we recommend 6.x)"
|
|
141
|
+
(_version_used, _version_used_string) = _get_version(_dependency_package)
|
|
142
|
+
if _version_used and _version_used < _next_supported_version_tuple:
|
|
143
|
+
warnings.warn(
|
|
144
|
+
f"Package {_package_label} depends on "
|
|
145
|
+
+ f"{_dependency_package}, currently installed at version "
|
|
146
|
+
+ f"{_version_used_string}. Future updates to "
|
|
147
|
+
+ f"{_package_label} will require {_dependency_package} at "
|
|
148
|
+
+ f"version {_next_supported_version} or higher{_recommendation}."
|
|
149
|
+
+ " Please ensure "
|
|
150
|
+
+ "that either (a) your Python environment doesn't pin the "
|
|
151
|
+
+ f"version of {_dependency_package}, so that updates to "
|
|
152
|
+
+ f"{_package_label} can require the higher version, or "
|
|
153
|
+
+ "(b) you manually update your Python environment to use at "
|
|
154
|
+
+ f"least version {_next_supported_version} of "
|
|
155
|
+
+ f"{_dependency_package}.",
|
|
156
|
+
FutureWarning,
|
|
157
|
+
)
|
|
158
|
+
except Exception:
|
|
159
|
+
warnings.warn(
|
|
160
|
+
"Could not determine the version of Python "
|
|
161
|
+
+ "currently being used. To continue receiving "
|
|
162
|
+
+ "updates for {_package_label}, ensure you are "
|
|
163
|
+
+ "using a supported version of Python; see "
|
|
164
|
+
+ "https://devguide.python.org/versions/"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
__all__ = (
|
|
168
|
+
"AutomatedBackupConfig",
|
|
169
|
+
"Backup",
|
|
170
|
+
"BackupCollection",
|
|
171
|
+
"BackupFile",
|
|
172
|
+
"BackupInstanceRequest",
|
|
173
|
+
"CertificateAuthority",
|
|
174
|
+
"ConnectionType",
|
|
175
|
+
"CreateInstanceRequest",
|
|
176
|
+
"CrossInstanceReplicationConfig",
|
|
177
|
+
"DeleteBackupRequest",
|
|
178
|
+
"DeleteInstanceRequest",
|
|
179
|
+
"DiscoveryEndpoint",
|
|
180
|
+
"EncryptionInfo",
|
|
181
|
+
"ExportBackupRequest",
|
|
182
|
+
"GetBackupCollectionRequest",
|
|
183
|
+
"GetBackupRequest",
|
|
184
|
+
"GetCertificateAuthorityRequest",
|
|
185
|
+
"GetInstanceRequest",
|
|
186
|
+
"Instance",
|
|
187
|
+
"ListBackupCollectionsRequest",
|
|
188
|
+
"ListBackupCollectionsResponse",
|
|
189
|
+
"ListBackupsRequest",
|
|
190
|
+
"ListBackupsResponse",
|
|
191
|
+
"ListInstancesRequest",
|
|
192
|
+
"ListInstancesResponse",
|
|
193
|
+
"MaintenancePolicy",
|
|
194
|
+
"MaintenanceSchedule",
|
|
195
|
+
"MemorystoreClient",
|
|
196
|
+
"NodeConfig",
|
|
197
|
+
"OperationMetadata",
|
|
198
|
+
"PersistenceConfig",
|
|
199
|
+
"PscAttachmentDetail",
|
|
200
|
+
"PscAutoConnection",
|
|
201
|
+
"PscConnection",
|
|
202
|
+
"PscConnectionStatus",
|
|
203
|
+
"RescheduleMaintenanceRequest",
|
|
204
|
+
"UpdateInstanceRequest",
|
|
205
|
+
"WeeklyMaintenanceWindow",
|
|
206
|
+
"ZoneDistributionConfig",
|
|
207
|
+
)
|
|
@@ -151,6 +151,34 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
151
151
|
_DEFAULT_ENDPOINT_TEMPLATE = "memorystore.{UNIVERSE_DOMAIN}"
|
|
152
152
|
_DEFAULT_UNIVERSE = "googleapis.com"
|
|
153
153
|
|
|
154
|
+
@staticmethod
|
|
155
|
+
def _use_client_cert_effective():
|
|
156
|
+
"""Returns whether client certificate should be used for mTLS if the
|
|
157
|
+
google-auth version supports should_use_client_cert automatic mTLS enablement.
|
|
158
|
+
|
|
159
|
+
Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
bool: whether client certificate should be used for mTLS
|
|
163
|
+
Raises:
|
|
164
|
+
ValueError: (If using a version of google-auth without should_use_client_cert and
|
|
165
|
+
GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
|
|
166
|
+
"""
|
|
167
|
+
# check if google-auth version supports should_use_client_cert for automatic mTLS enablement
|
|
168
|
+
if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
|
|
169
|
+
return mtls.should_use_client_cert()
|
|
170
|
+
else: # pragma: NO COVER
|
|
171
|
+
# if unsupported, fallback to reading from env var
|
|
172
|
+
use_client_cert_str = os.getenv(
|
|
173
|
+
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
|
|
174
|
+
).lower()
|
|
175
|
+
if use_client_cert_str not in ("true", "false"):
|
|
176
|
+
raise ValueError(
|
|
177
|
+
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
|
|
178
|
+
" either `true` or `false`"
|
|
179
|
+
)
|
|
180
|
+
return use_client_cert_str == "true"
|
|
181
|
+
|
|
154
182
|
@classmethod
|
|
155
183
|
def from_service_account_info(cls, info: dict, *args, **kwargs):
|
|
156
184
|
"""Creates an instance of this client using the provided credentials
|
|
@@ -290,6 +318,32 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
290
318
|
)
|
|
291
319
|
return m.groupdict() if m else {}
|
|
292
320
|
|
|
321
|
+
@staticmethod
|
|
322
|
+
def crypto_key_version_path(
|
|
323
|
+
project: str,
|
|
324
|
+
location: str,
|
|
325
|
+
key_ring: str,
|
|
326
|
+
crypto_key: str,
|
|
327
|
+
crypto_key_version: str,
|
|
328
|
+
) -> str:
|
|
329
|
+
"""Returns a fully-qualified crypto_key_version string."""
|
|
330
|
+
return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(
|
|
331
|
+
project=project,
|
|
332
|
+
location=location,
|
|
333
|
+
key_ring=key_ring,
|
|
334
|
+
crypto_key=crypto_key,
|
|
335
|
+
crypto_key_version=crypto_key_version,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
@staticmethod
|
|
339
|
+
def parse_crypto_key_version_path(path: str) -> Dict[str, str]:
|
|
340
|
+
"""Parses a crypto_key_version path into its component segments."""
|
|
341
|
+
m = re.match(
|
|
342
|
+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)/cryptoKeyVersions/(?P<crypto_key_version>.+?)$",
|
|
343
|
+
path,
|
|
344
|
+
)
|
|
345
|
+
return m.groupdict() if m else {}
|
|
346
|
+
|
|
293
347
|
@staticmethod
|
|
294
348
|
def forwarding_rule_path(
|
|
295
349
|
project: str,
|
|
@@ -493,12 +547,8 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
493
547
|
)
|
|
494
548
|
if client_options is None:
|
|
495
549
|
client_options = client_options_lib.ClientOptions()
|
|
496
|
-
use_client_cert =
|
|
550
|
+
use_client_cert = MemorystoreClient._use_client_cert_effective()
|
|
497
551
|
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
|
|
498
|
-
if use_client_cert not in ("true", "false"):
|
|
499
|
-
raise ValueError(
|
|
500
|
-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
|
|
501
|
-
)
|
|
502
552
|
if use_mtls_endpoint not in ("auto", "never", "always"):
|
|
503
553
|
raise MutualTLSChannelError(
|
|
504
554
|
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
|
|
@@ -506,7 +556,7 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
506
556
|
|
|
507
557
|
# Figure out the client cert source to use.
|
|
508
558
|
client_cert_source = None
|
|
509
|
-
if use_client_cert
|
|
559
|
+
if use_client_cert:
|
|
510
560
|
if client_options.client_cert_source:
|
|
511
561
|
client_cert_source = client_options.client_cert_source
|
|
512
562
|
elif mtls.has_default_client_cert_source():
|
|
@@ -538,20 +588,14 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
538
588
|
google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
|
|
539
589
|
is not any of ["auto", "never", "always"].
|
|
540
590
|
"""
|
|
541
|
-
use_client_cert =
|
|
542
|
-
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
|
|
543
|
-
).lower()
|
|
591
|
+
use_client_cert = MemorystoreClient._use_client_cert_effective()
|
|
544
592
|
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
|
|
545
593
|
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
|
|
546
|
-
if use_client_cert not in ("true", "false"):
|
|
547
|
-
raise ValueError(
|
|
548
|
-
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
|
|
549
|
-
)
|
|
550
594
|
if use_mtls_endpoint not in ("auto", "never", "always"):
|
|
551
595
|
raise MutualTLSChannelError(
|
|
552
596
|
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
|
|
553
597
|
)
|
|
554
|
-
return use_client_cert
|
|
598
|
+
return use_client_cert, use_mtls_endpoint, universe_domain_env
|
|
555
599
|
|
|
556
600
|
@staticmethod
|
|
557
601
|
def _get_client_cert_source(provided_cert_source, use_cert_flag):
|
|
@@ -1160,12 +1204,12 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
|
|
|
1160
1204
|
|
|
1161
1205
|
This value is subject to the following restrictions:
|
|
1162
1206
|
|
|
1163
|
-
-
|
|
1164
|
-
-
|
|
1165
|
-
-
|
|
1166
|
-
|
|
1167
|
-
-
|
|
1168
|
-
-
|
|
1207
|
+
- Must be 4-63 characters in length
|
|
1208
|
+
- Must begin with a letter or digit
|
|
1209
|
+
- Must contain only lowercase letters, digits, and
|
|
1210
|
+
hyphens
|
|
1211
|
+
- Must not end with a hyphen
|
|
1212
|
+
- Must be unique within a location
|
|
1169
1213
|
|
|
1170
1214
|
This corresponds to the ``instance_id`` field
|
|
1171
1215
|
on the ``request`` instance; if ``request`` is provided, this
|
|
@@ -68,9 +68,10 @@ class MemorystoreTransport(abc.ABC):
|
|
|
68
68
|
credentials identify the application to the service; if none
|
|
69
69
|
are specified, the client will attempt to ascertain the
|
|
70
70
|
credentials from the environment.
|
|
71
|
-
credentials_file (Optional[str]): A file with credentials that can
|
|
71
|
+
credentials_file (Optional[str]): Deprecated. A file with credentials that can
|
|
72
72
|
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
73
|
-
This argument is mutually exclusive with credentials.
|
|
73
|
+
This argument is mutually exclusive with credentials. This argument will be
|
|
74
|
+
removed in the next major version of this library.
|
|
74
75
|
scopes (Optional[Sequence[str]]): A list of scopes.
|
|
75
76
|
quota_project_id (Optional[str]): An optional project to use for billing
|
|
76
77
|
and quota.
|
|
@@ -1058,9 +1058,10 @@ class MemorystoreRestTransport(_BaseMemorystoreRestTransport):
|
|
|
1058
1058
|
are specified, the client will attempt to ascertain the
|
|
1059
1059
|
credentials from the environment.
|
|
1060
1060
|
|
|
1061
|
-
credentials_file (Optional[str]): A file with credentials that can
|
|
1061
|
+
credentials_file (Optional[str]): Deprecated. A file with credentials that can
|
|
1062
1062
|
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
1063
|
-
This argument is ignored if ``channel`` is provided.
|
|
1063
|
+
This argument is ignored if ``channel`` is provided. This argument will be
|
|
1064
|
+
removed in the next major version of this library.
|
|
1064
1065
|
scopes (Optional(Sequence[str])): A list of scopes. This argument is
|
|
1065
1066
|
ignored if ``channel`` is provided.
|
|
1066
1067
|
client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
|
|
@@ -26,6 +26,7 @@ from .memorystore import (
|
|
|
26
26
|
DeleteBackupRequest,
|
|
27
27
|
DeleteInstanceRequest,
|
|
28
28
|
DiscoveryEndpoint,
|
|
29
|
+
EncryptionInfo,
|
|
29
30
|
ExportBackupRequest,
|
|
30
31
|
GetBackupCollectionRequest,
|
|
31
32
|
GetBackupRequest,
|
|
@@ -65,6 +66,7 @@ __all__ = (
|
|
|
65
66
|
"DeleteBackupRequest",
|
|
66
67
|
"DeleteInstanceRequest",
|
|
67
68
|
"DiscoveryEndpoint",
|
|
69
|
+
"EncryptionInfo",
|
|
68
70
|
"ExportBackupRequest",
|
|
69
71
|
"GetBackupCollectionRequest",
|
|
70
72
|
"GetBackupRequest",
|