google-cloud-memorystore 0.1.0__tar.gz → 0.1.2__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.
Files changed (52) hide show
  1. {google_cloud_memorystore-0.1.0/google_cloud_memorystore.egg-info → google_cloud_memorystore-0.1.2}/PKG-INFO +97 -8
  2. google_cloud_memorystore-0.1.2/README.rst +197 -0
  3. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore/gapic_version.py +1 -1
  4. {google_cloud_memorystore-0.1.0/google/cloud/memorystore_v1beta → google_cloud_memorystore-0.1.2/google/cloud/memorystore_v1}/gapic_version.py +1 -1
  5. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/client.py +105 -42
  6. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/transports/rest.py +178 -12
  7. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/types/memorystore.py +4 -1
  8. {google_cloud_memorystore-0.1.0/google/cloud/memorystore_v1 → google_cloud_memorystore-0.1.2/google/cloud/memorystore_v1beta}/gapic_version.py +1 -1
  9. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/client.py +105 -42
  10. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/transports/rest.py +178 -12
  11. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/types/memorystore.py +4 -1
  12. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2/google_cloud_memorystore.egg-info}/PKG-INFO +97 -8
  13. google_cloud_memorystore-0.1.2/google_cloud_memorystore.egg-info/requires.txt +7 -0
  14. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/setup.py +5 -5
  15. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/gapic/memorystore_v1/test_memorystore.py +81 -0
  16. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/gapic/memorystore_v1beta/test_memorystore.py +81 -0
  17. google_cloud_memorystore-0.1.0/README.rst +0 -108
  18. google_cloud_memorystore-0.1.0/google_cloud_memorystore.egg-info/requires.txt +0 -7
  19. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/LICENSE +0 -0
  20. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/MANIFEST.in +0 -0
  21. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore/__init__.py +0 -0
  22. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore/py.typed +0 -0
  23. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/__init__.py +0 -0
  24. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/gapic_metadata.json +0 -0
  25. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/py.typed +0 -0
  26. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/__init__.py +0 -0
  27. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/__init__.py +0 -0
  28. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/pagers.py +0 -0
  29. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/transports/__init__.py +0 -0
  30. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/transports/base.py +0 -0
  31. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/services/memorystore/transports/rest_base.py +0 -0
  32. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1/types/__init__.py +0 -0
  33. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/__init__.py +0 -0
  34. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/gapic_metadata.json +0 -0
  35. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/py.typed +0 -0
  36. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/__init__.py +0 -0
  37. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/__init__.py +0 -0
  38. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/pagers.py +0 -0
  39. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/transports/__init__.py +0 -0
  40. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/transports/base.py +0 -0
  41. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/services/memorystore/transports/rest_base.py +0 -0
  42. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google/cloud/memorystore_v1beta/types/__init__.py +0 -0
  43. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google_cloud_memorystore.egg-info/SOURCES.txt +0 -0
  44. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google_cloud_memorystore.egg-info/dependency_links.txt +0 -0
  45. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google_cloud_memorystore.egg-info/not-zip-safe +0 -0
  46. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/google_cloud_memorystore.egg-info/top_level.txt +0 -0
  47. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/setup.cfg +0 -0
  48. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/__init__.py +0 -0
  49. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/__init__.py +0 -0
  50. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/gapic/__init__.py +0 -0
  51. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/gapic/memorystore_v1/__init__.py +0 -0
  52. {google_cloud_memorystore-0.1.0 → google_cloud_memorystore-0.1.2}/tests/unit/gapic/memorystore_v1beta/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-cloud-memorystore
3
- Version: 0.1.0
3
+ Version: 0.1.2
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
@@ -23,11 +23,11 @@ Classifier: Operating System :: OS Independent
23
23
  Classifier: Topic :: Internet
24
24
  Requires-Python: >=3.7
25
25
  License-File: LICENSE
26
- 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.0dev,>=1.34.1
27
- Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0dev,>=2.14.1
28
- Requires-Dist: proto-plus<2.0.0dev,>=1.22.3
29
- Requires-Dist: proto-plus<2.0.0dev,>=1.25.0; python_version >= "3.13"
30
- Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.2
26
+ 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
+ Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
28
+ Requires-Dist: proto-plus<2.0.0,>=1.22.3
29
+ Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
30
+ 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
31
31
 
32
32
  Python Client for Memorystore
33
33
  =============================
@@ -57,12 +57,12 @@ In order to use this library, you first need to go through the following steps:
57
57
  1. `Select or create a Cloud Platform project.`_
58
58
  2. `Enable billing for your project.`_
59
59
  3. `Enable the Memorystore.`_
60
- 4. `Setup Authentication.`_
60
+ 4. `Set up Authentication.`_
61
61
 
62
62
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
63
63
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
64
64
  .. _Enable the Memorystore.: https://cloud.google.com/memorystore/docs/valkey
65
- .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
65
+ .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
66
66
 
67
67
  Installation
68
68
  ~~~~~~~~~~~~
@@ -137,3 +137,92 @@ Next Steps
137
137
 
138
138
  .. _Memorystore Product documentation: https://cloud.google.com/memorystore/docs/valkey
139
139
  .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
140
+
141
+ Logging
142
+ -------
143
+
144
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
145
+ Note the following:
146
+
147
+ #. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
148
+ #. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
149
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
150
+
151
+ Simple, environment-based configuration
152
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153
+
154
+ To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
155
+ logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
156
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
157
+ event.
158
+
159
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
160
+
161
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
162
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
163
+
164
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
165
+
166
+ Environment-Based Examples
167
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
168
+
169
+ - Enabling the default handler for all Google-based loggers
170
+
171
+ .. code-block:: console
172
+
173
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
174
+
175
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
176
+
177
+ .. code-block:: console
178
+
179
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
180
+
181
+
182
+ Advanced, code-based configuration
183
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
+
185
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
186
+
187
+ Code-Based Examples
188
+ ^^^^^^^^^^^^^^^^^^^
189
+
190
+ - Configuring a handler for all Google-based loggers
191
+
192
+ .. code-block:: python
193
+
194
+ import logging
195
+
196
+ from google.cloud.translate_v3 import translate
197
+
198
+ base_logger = logging.getLogger("google")
199
+ base_logger.addHandler(logging.StreamHandler())
200
+ base_logger.setLevel(logging.DEBUG)
201
+
202
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
203
+
204
+ .. code-block:: python
205
+
206
+ import logging
207
+
208
+ from google.cloud.translate_v3 import translate
209
+
210
+ base_logger = logging.getLogger("google.cloud.library_v1")
211
+ base_logger.addHandler(logging.StreamHandler())
212
+ base_logger.setLevel(logging.DEBUG)
213
+
214
+ Logging details
215
+ ~~~~~~~~~~~~~~~
216
+
217
+ #. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
218
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
219
+ :code:`logging.getLogger("google").propagate = True` in your code.
220
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
221
+ one library, but decide you need to also set up environment-based logging configuration for another library.
222
+
223
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
224
+ if the code -based configuration gets applied first.
225
+
226
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
227
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
228
+ (This is the reason for 2.i. above.)
@@ -0,0 +1,197 @@
1
+ Python Client for Memorystore
2
+ =============================
3
+
4
+ |preview| |pypi| |versions|
5
+
6
+ `Memorystore`_: Memorystore for Valkey is a fully managed Valkey Cluster service for Google Cloud. Applications running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, secure Valkey service without the burden of managing complex Valkey deployments.
7
+
8
+ - `Client Library Documentation`_
9
+ - `Product Documentation`_
10
+
11
+ .. |preview| image:: https://img.shields.io/badge/support-preview-orange.svg
12
+ :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
13
+ .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-memorystore.svg
14
+ :target: https://pypi.org/project/google-cloud-memorystore/
15
+ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-memorystore.svg
16
+ :target: https://pypi.org/project/google-cloud-memorystore/
17
+ .. _Memorystore: https://cloud.google.com/memorystore/docs/valkey
18
+ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-memorystore/latest/summary_overview
19
+ .. _Product Documentation: https://cloud.google.com/memorystore/docs/valkey
20
+
21
+ Quick Start
22
+ -----------
23
+
24
+ In order to use this library, you first need to go through the following steps:
25
+
26
+ 1. `Select or create a Cloud Platform project.`_
27
+ 2. `Enable billing for your project.`_
28
+ 3. `Enable the Memorystore.`_
29
+ 4. `Set up Authentication.`_
30
+
31
+ .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
32
+ .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
33
+ .. _Enable the Memorystore.: https://cloud.google.com/memorystore/docs/valkey
34
+ .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
35
+
36
+ Installation
37
+ ~~~~~~~~~~~~
38
+
39
+ Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
40
+ creates isolated Python environments. These isolated environments can have separate
41
+ versions of Python packages, which allows you to isolate one project's dependencies
42
+ from the dependencies of other projects.
43
+
44
+ With `venv`_, it's possible to install this library without needing system
45
+ install permissions, and without clashing with the installed system
46
+ dependencies.
47
+
48
+ .. _`venv`: https://docs.python.org/3/library/venv.html
49
+
50
+
51
+ Code samples and snippets
52
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
53
+
54
+ Code samples and snippets live in the `samples/`_ folder.
55
+
56
+ .. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-memorystore/samples
57
+
58
+
59
+ Supported Python Versions
60
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
61
+ Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
62
+ Python.
63
+
64
+ Python >= 3.7
65
+
66
+ .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
67
+ .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
68
+
69
+ Unsupported Python Versions
70
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
+ Python <= 3.6
72
+
73
+ If you are using an `end-of-life`_
74
+ version of Python, we recommend that you update as soon as possible to an actively supported version.
75
+
76
+ .. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches
77
+
78
+ Mac/Linux
79
+ ^^^^^^^^^
80
+
81
+ .. code-block:: console
82
+
83
+ python3 -m venv <your-env>
84
+ source <your-env>/bin/activate
85
+ pip install google-cloud-memorystore
86
+
87
+
88
+ Windows
89
+ ^^^^^^^
90
+
91
+ .. code-block:: console
92
+
93
+ py -m venv <your-env>
94
+ .\<your-env>\Scripts\activate
95
+ pip install google-cloud-memorystore
96
+
97
+ Next Steps
98
+ ~~~~~~~~~~
99
+
100
+ - Read the `Client Library Documentation`_ for Memorystore
101
+ to see other available methods on the client.
102
+ - Read the `Memorystore Product documentation`_ to learn
103
+ more about the product and see How-to Guides.
104
+ - View this `README`_ to see the full list of Cloud
105
+ APIs that we cover.
106
+
107
+ .. _Memorystore Product documentation: https://cloud.google.com/memorystore/docs/valkey
108
+ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
109
+
110
+ Logging
111
+ -------
112
+
113
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
114
+ Note the following:
115
+
116
+ #. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
117
+ #. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
118
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
119
+
120
+ Simple, environment-based configuration
121
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122
+
123
+ To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
124
+ logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
125
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
126
+ event.
127
+
128
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
129
+
130
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
131
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
132
+
133
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
134
+
135
+ Environment-Based Examples
136
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
137
+
138
+ - Enabling the default handler for all Google-based loggers
139
+
140
+ .. code-block:: console
141
+
142
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
143
+
144
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
145
+
146
+ .. code-block:: console
147
+
148
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
149
+
150
+
151
+ Advanced, code-based configuration
152
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153
+
154
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
155
+
156
+ Code-Based Examples
157
+ ^^^^^^^^^^^^^^^^^^^
158
+
159
+ - Configuring a handler for all Google-based loggers
160
+
161
+ .. code-block:: python
162
+
163
+ import logging
164
+
165
+ from google.cloud.translate_v3 import translate
166
+
167
+ base_logger = logging.getLogger("google")
168
+ base_logger.addHandler(logging.StreamHandler())
169
+ base_logger.setLevel(logging.DEBUG)
170
+
171
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
172
+
173
+ .. code-block:: python
174
+
175
+ import logging
176
+
177
+ from google.cloud.translate_v3 import translate
178
+
179
+ base_logger = logging.getLogger("google.cloud.library_v1")
180
+ base_logger.addHandler(logging.StreamHandler())
181
+ base_logger.setLevel(logging.DEBUG)
182
+
183
+ Logging details
184
+ ~~~~~~~~~~~~~~~
185
+
186
+ #. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
187
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
188
+ :code:`logging.getLogger("google").propagate = True` in your code.
189
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
190
+ one library, but decide you need to also set up environment-based logging configuration for another library.
191
+
192
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
193
+ if the code -based configuration gets applied first.
194
+
195
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
196
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
197
+ (This is the reason for 2.i. above.)
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.1.0" # {x-release-please-version}
16
+ __version__ = "0.1.2" # {x-release-please-version}
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.1.0" # {x-release-please-version}
16
+ __version__ = "0.1.2" # {x-release-please-version}
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ import json
17
19
  import logging as std_logging
18
20
  import os
19
21
  import re
@@ -571,6 +573,33 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
571
573
  # NOTE (b/349488459): universe validation is disabled until further notice.
572
574
  return True
573
575
 
576
+ def _add_cred_info_for_auth_errors(
577
+ self, error: core_exceptions.GoogleAPICallError
578
+ ) -> None:
579
+ """Adds credential info string to error details for 401/403/404 errors.
580
+
581
+ Args:
582
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
583
+ """
584
+ if error.code not in [
585
+ HTTPStatus.UNAUTHORIZED,
586
+ HTTPStatus.FORBIDDEN,
587
+ HTTPStatus.NOT_FOUND,
588
+ ]:
589
+ return
590
+
591
+ cred = self._transport._credentials
592
+
593
+ # get_cred_info is only available in google-auth>=2.35.0
594
+ if not hasattr(cred, "get_cred_info"):
595
+ return
596
+
597
+ # ignore the type check since pypy test fails when get_cred_info
598
+ # is not available
599
+ cred_info = cred.get_cred_info() # type: ignore
600
+ if cred_info and hasattr(error._details, "append"):
601
+ error._details.append(json.dumps(cred_info))
602
+
574
603
  @property
575
604
  def api_endpoint(self):
576
605
  """Return the API endpoint used by the client instance.
@@ -832,7 +861,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
832
861
  # Create or coerce a protobuf request object.
833
862
  # - Quick check: If we got a request object, we should *not* have
834
863
  # gotten any keyword arguments that map to the request.
835
- has_flattened_params = any([parent])
864
+ flattened_params = [parent]
865
+ has_flattened_params = (
866
+ len([param for param in flattened_params if param is not None]) > 0
867
+ )
836
868
  if request is not None and has_flattened_params:
837
869
  raise ValueError(
838
870
  "If the `request` argument is set, then none of "
@@ -946,7 +978,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
946
978
  # Create or coerce a protobuf request object.
947
979
  # - Quick check: If we got a request object, we should *not* have
948
980
  # gotten any keyword arguments that map to the request.
949
- has_flattened_params = any([name])
981
+ flattened_params = [name]
982
+ has_flattened_params = (
983
+ len([param for param in flattened_params if param is not None]) > 0
984
+ )
950
985
  if request is not None and has_flattened_params:
951
986
  raise ValueError(
952
987
  "If the `request` argument is set, then none of "
@@ -1090,7 +1125,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1090
1125
  # Create or coerce a protobuf request object.
1091
1126
  # - Quick check: If we got a request object, we should *not* have
1092
1127
  # gotten any keyword arguments that map to the request.
1093
- has_flattened_params = any([parent, instance, instance_id])
1128
+ flattened_params = [parent, instance, instance_id]
1129
+ has_flattened_params = (
1130
+ len([param for param in flattened_params if param is not None]) > 0
1131
+ )
1094
1132
  if request is not None and has_flattened_params:
1095
1133
  raise ValueError(
1096
1134
  "If the `request` argument is set, then none of "
@@ -1225,7 +1263,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1225
1263
  # Create or coerce a protobuf request object.
1226
1264
  # - Quick check: If we got a request object, we should *not* have
1227
1265
  # gotten any keyword arguments that map to the request.
1228
- has_flattened_params = any([instance, update_mask])
1266
+ flattened_params = [instance, update_mask]
1267
+ has_flattened_params = (
1268
+ len([param for param in flattened_params if param is not None]) > 0
1269
+ )
1229
1270
  if request is not None and has_flattened_params:
1230
1271
  raise ValueError(
1231
1272
  "If the `request` argument is set, then none of "
@@ -1356,7 +1397,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1356
1397
  # Create or coerce a protobuf request object.
1357
1398
  # - Quick check: If we got a request object, we should *not* have
1358
1399
  # gotten any keyword arguments that map to the request.
1359
- has_flattened_params = any([name])
1400
+ flattened_params = [name]
1401
+ has_flattened_params = (
1402
+ len([param for param in flattened_params if param is not None]) > 0
1403
+ )
1360
1404
  if request is not None and has_flattened_params:
1361
1405
  raise ValueError(
1362
1406
  "If the `request` argument is set, then none of "
@@ -1473,7 +1517,10 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1473
1517
  # Create or coerce a protobuf request object.
1474
1518
  # - Quick check: If we got a request object, we should *not* have
1475
1519
  # gotten any keyword arguments that map to the request.
1476
- has_flattened_params = any([name])
1520
+ flattened_params = [name]
1521
+ has_flattened_params = (
1522
+ len([param for param in flattened_params if param is not None]) > 0
1523
+ )
1477
1524
  if request is not None and has_flattened_params:
1478
1525
  raise ValueError(
1479
1526
  "If the `request` argument is set, then none of "
@@ -1572,16 +1619,20 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1572
1619
  # Validate the universe domain.
1573
1620
  self._validate_universe_domain()
1574
1621
 
1575
- # Send the request.
1576
- response = rpc(
1577
- request,
1578
- retry=retry,
1579
- timeout=timeout,
1580
- metadata=metadata,
1581
- )
1622
+ try:
1623
+ # Send the request.
1624
+ response = rpc(
1625
+ request,
1626
+ retry=retry,
1627
+ timeout=timeout,
1628
+ metadata=metadata,
1629
+ )
1582
1630
 
1583
- # Done; return the response.
1584
- return response
1631
+ # Done; return the response.
1632
+ return response
1633
+ except core_exceptions.GoogleAPICallError as e:
1634
+ self._add_cred_info_for_auth_errors(e)
1635
+ raise e
1585
1636
 
1586
1637
  def get_operation(
1587
1638
  self,
@@ -1627,16 +1678,20 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1627
1678
  # Validate the universe domain.
1628
1679
  self._validate_universe_domain()
1629
1680
 
1630
- # Send the request.
1631
- response = rpc(
1632
- request,
1633
- retry=retry,
1634
- timeout=timeout,
1635
- metadata=metadata,
1636
- )
1681
+ try:
1682
+ # Send the request.
1683
+ response = rpc(
1684
+ request,
1685
+ retry=retry,
1686
+ timeout=timeout,
1687
+ metadata=metadata,
1688
+ )
1637
1689
 
1638
- # Done; return the response.
1639
- return response
1690
+ # Done; return the response.
1691
+ return response
1692
+ except core_exceptions.GoogleAPICallError as e:
1693
+ self._add_cred_info_for_auth_errors(e)
1694
+ raise e
1640
1695
 
1641
1696
  def delete_operation(
1642
1697
  self,
@@ -1793,16 +1848,20 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1793
1848
  # Validate the universe domain.
1794
1849
  self._validate_universe_domain()
1795
1850
 
1796
- # Send the request.
1797
- response = rpc(
1798
- request,
1799
- retry=retry,
1800
- timeout=timeout,
1801
- metadata=metadata,
1802
- )
1851
+ try:
1852
+ # Send the request.
1853
+ response = rpc(
1854
+ request,
1855
+ retry=retry,
1856
+ timeout=timeout,
1857
+ metadata=metadata,
1858
+ )
1803
1859
 
1804
- # Done; return the response.
1805
- return response
1860
+ # Done; return the response.
1861
+ return response
1862
+ except core_exceptions.GoogleAPICallError as e:
1863
+ self._add_cred_info_for_auth_errors(e)
1864
+ raise e
1806
1865
 
1807
1866
  def list_locations(
1808
1867
  self,
@@ -1848,16 +1907,20 @@ class MemorystoreClient(metaclass=MemorystoreClientMeta):
1848
1907
  # Validate the universe domain.
1849
1908
  self._validate_universe_domain()
1850
1909
 
1851
- # Send the request.
1852
- response = rpc(
1853
- request,
1854
- retry=retry,
1855
- timeout=timeout,
1856
- metadata=metadata,
1857
- )
1910
+ try:
1911
+ # Send the request.
1912
+ response = rpc(
1913
+ request,
1914
+ retry=retry,
1915
+ timeout=timeout,
1916
+ metadata=metadata,
1917
+ )
1858
1918
 
1859
- # Done; return the response.
1860
- return response
1919
+ # Done; return the response.
1920
+ return response
1921
+ except core_exceptions.GoogleAPICallError as e:
1922
+ self._add_cred_info_for_auth_errors(e)
1923
+ raise e
1861
1924
 
1862
1925
 
1863
1926
  DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(