google-cloud-modelarmor 0.4.0__tar.gz → 0.6.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.
Files changed (57) hide show
  1. {google_cloud_modelarmor-0.4.0/google_cloud_modelarmor.egg-info → google_cloud_modelarmor-0.6.0}/PKG-INFO +18 -18
  2. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/README.rst +14 -12
  3. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/gapic_version.py +1 -1
  4. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/__init__.py +1 -0
  5. {google_cloud_modelarmor-0.4.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1}/gapic_version.py +1 -1
  6. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/async_client.py +31 -17
  7. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/client.py +37 -28
  8. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/pagers.py +2 -2
  9. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/base.py +16 -7
  10. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc.py +12 -8
  11. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc_asyncio.py +11 -7
  12. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest.py +11 -7
  13. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest_base.py +1 -1
  14. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/types/service.py +23 -8
  15. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/__init__.py +5 -0
  16. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/gapic_metadata.json +30 -0
  17. {google_cloud_modelarmor-0.4.0/google/cloud/modelarmor_v1 → google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta}/gapic_version.py +1 -1
  18. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/async_client.py +208 -17
  19. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/client.py +213 -28
  20. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/pagers.py +2 -2
  21. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/base.py +50 -7
  22. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc.py +72 -8
  23. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc_asyncio.py +83 -7
  24. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest.py +72 -7
  25. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest_base.py +9 -1
  26. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/types/__init__.py +4 -0
  27. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/types/service.py +163 -15
  28. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info}/PKG-INFO +18 -18
  29. google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info/requires.txt +11 -0
  30. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/setup.py +3 -5
  31. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1/test_model_armor.py +286 -176
  32. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py +692 -176
  33. google_cloud_modelarmor-0.4.0/google_cloud_modelarmor.egg-info/requires.txt +0 -11
  34. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/LICENSE +0 -0
  35. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/MANIFEST.in +0 -0
  36. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/__init__.py +0 -0
  37. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/py.typed +0 -0
  38. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/gapic_metadata.json +0 -0
  39. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/py.typed +0 -0
  40. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/__init__.py +0 -0
  41. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/__init__.py +0 -0
  42. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/__init__.py +0 -0
  43. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/types/__init__.py +0 -0
  44. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/py.typed +0 -0
  45. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/__init__.py +0 -0
  46. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/__init__.py +0 -0
  47. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/__init__.py +0 -0
  48. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/SOURCES.txt +0 -0
  49. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/dependency_links.txt +0 -0
  50. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/not-zip-safe +0 -0
  51. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/top_level.txt +0 -0
  52. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/setup.cfg +0 -0
  53. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/__init__.py +0 -0
  54. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/__init__.py +0 -0
  55. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/__init__.py +0 -0
  56. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1/__init__.py +0 -0
  57. {google_cloud_modelarmor-0.4.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1beta/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-modelarmor
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: Google Cloud Modelarmor API client library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-modelarmor
6
6
  Author: Google LLC
@@ -12,8 +12,6 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
19
17
  Classifier: Programming Language :: Python :: 3.11
@@ -22,15 +20,15 @@ Classifier: Programming Language :: Python :: 3.13
22
20
  Classifier: Programming Language :: Python :: 3.14
23
21
  Classifier: Operating System :: OS Independent
24
22
  Classifier: Topic :: Internet
25
- Requires-Python: >=3.7
23
+ Requires-Python: >=3.9
26
24
  License-File: LICENSE
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
25
+ Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.0
28
26
  Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
29
27
  Requires-Dist: grpcio<2.0.0,>=1.33.2
30
28
  Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
31
29
  Requires-Dist: proto-plus<2.0.0,>=1.22.3
32
30
  Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
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
31
+ Requires-Dist: protobuf<8.0.0,>=4.25.8
34
32
  Dynamic: author
35
33
  Dynamic: author-email
36
34
  Dynamic: classifier
@@ -43,12 +41,14 @@ Dynamic: requires-dist
43
41
  Dynamic: requires-python
44
42
  Dynamic: summary
45
43
 
46
- Python Client for Model Armor API
47
- =================================
44
+ Python Client for Model Armor
45
+ =============================
48
46
 
49
47
  |preview| |pypi| |versions|
50
48
 
51
- `Model Armor API`_: Model Armor helps you protect against risks like prompt injection, harmful content, and data leakage in generative AI applications by letting you define policies that filter user prompts and model responses.
49
+ `Model Armor`_: Model Armor helps you protect against risks like prompt injection, harmful
50
+ content, and data leakage in generative AI applications by letting you
51
+ define policies that filter user prompts and model responses.
52
52
 
53
53
  - `Client Library Documentation`_
54
54
  - `Product Documentation`_
@@ -59,9 +59,9 @@ Python Client for Model Armor API
59
59
  :target: https://pypi.org/project/google-cloud-modelarmor/
60
60
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-modelarmor.svg
61
61
  :target: https://pypi.org/project/google-cloud-modelarmor/
62
- .. _Model Armor API: https://cloud.google.com/security-command-center/docs/model-armor-overview
62
+ .. _Model Armor: https://cloud.google.com/security-command-center/
63
63
  .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-modelarmor/latest/summary_overview
64
- .. _Product Documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
64
+ .. _Product Documentation: https://cloud.google.com/security-command-center/
65
65
 
66
66
  Quick Start
67
67
  -----------
@@ -70,12 +70,12 @@ In order to use this library, you first need to go through the following steps:
70
70
 
71
71
  1. `Select or create a Cloud Platform project.`_
72
72
  2. `Enable billing for your project.`_
73
- 3. `Enable the Model Armor API.`_
73
+ 3. `Enable the Model Armor.`_
74
74
  4. `Set up Authentication.`_
75
75
 
76
76
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
77
77
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
78
- .. _Enable the Model Armor API.: https://cloud.google.com/security-command-center/docs/model-armor-overview
78
+ .. _Enable the Model Armor.: https://cloud.google.com/security-command-center/
79
79
  .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
80
80
 
81
81
  Installation
@@ -106,14 +106,14 @@ Supported Python Versions
106
106
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
107
107
  Python.
108
108
 
109
- Python >= 3.7, including 3.14
109
+ Python >= 3.9, including 3.14
110
110
 
111
111
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
112
112
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
113
113
 
114
114
  Unsupported Python Versions
115
115
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
- Python <= 3.6
116
+ Python <= 3.8
117
117
 
118
118
  If you are using an `end-of-life`_
119
119
  version of Python, we recommend that you update as soon as possible to an actively supported version.
@@ -142,14 +142,14 @@ Windows
142
142
  Next Steps
143
143
  ~~~~~~~~~~
144
144
 
145
- - Read the `Client Library Documentation`_ for Model Armor API
145
+ - Read the `Client Library Documentation`_ for Model Armor
146
146
  to see other available methods on the client.
147
- - Read the `Model Armor API Product documentation`_ to learn
147
+ - Read the `Model Armor Product documentation`_ to learn
148
148
  more about the product and see How-to Guides.
149
149
  - View this `README`_ to see the full list of Cloud
150
150
  APIs that we cover.
151
151
 
152
- .. _Model Armor API Product documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
152
+ .. _Model Armor Product documentation: https://cloud.google.com/security-command-center/
153
153
  .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
154
154
 
155
155
  Logging
@@ -1,9 +1,11 @@
1
- Python Client for Model Armor API
2
- =================================
1
+ Python Client for Model Armor
2
+ =============================
3
3
 
4
4
  |preview| |pypi| |versions|
5
5
 
6
- `Model Armor API`_: Model Armor helps you protect against risks like prompt injection, harmful content, and data leakage in generative AI applications by letting you define policies that filter user prompts and model responses.
6
+ `Model Armor`_: Model Armor helps you protect against risks like prompt injection, harmful
7
+ content, and data leakage in generative AI applications by letting you
8
+ define policies that filter user prompts and model responses.
7
9
 
8
10
  - `Client Library Documentation`_
9
11
  - `Product Documentation`_
@@ -14,9 +16,9 @@ Python Client for Model Armor API
14
16
  :target: https://pypi.org/project/google-cloud-modelarmor/
15
17
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-modelarmor.svg
16
18
  :target: https://pypi.org/project/google-cloud-modelarmor/
17
- .. _Model Armor API: https://cloud.google.com/security-command-center/docs/model-armor-overview
19
+ .. _Model Armor: https://cloud.google.com/security-command-center/
18
20
  .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-modelarmor/latest/summary_overview
19
- .. _Product Documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
21
+ .. _Product Documentation: https://cloud.google.com/security-command-center/
20
22
 
21
23
  Quick Start
22
24
  -----------
@@ -25,12 +27,12 @@ In order to use this library, you first need to go through the following steps:
25
27
 
26
28
  1. `Select or create a Cloud Platform project.`_
27
29
  2. `Enable billing for your project.`_
28
- 3. `Enable the Model Armor API.`_
30
+ 3. `Enable the Model Armor.`_
29
31
  4. `Set up Authentication.`_
30
32
 
31
33
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
32
34
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
33
- .. _Enable the Model Armor API.: https://cloud.google.com/security-command-center/docs/model-armor-overview
35
+ .. _Enable the Model Armor.: https://cloud.google.com/security-command-center/
34
36
  .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
35
37
 
36
38
  Installation
@@ -61,14 +63,14 @@ Supported Python Versions
61
63
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
62
64
  Python.
63
65
 
64
- Python >= 3.7, including 3.14
66
+ Python >= 3.9, including 3.14
65
67
 
66
68
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
67
69
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
68
70
 
69
71
  Unsupported Python Versions
70
72
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
- Python <= 3.6
73
+ Python <= 3.8
72
74
 
73
75
  If you are using an `end-of-life`_
74
76
  version of Python, we recommend that you update as soon as possible to an actively supported version.
@@ -97,14 +99,14 @@ Windows
97
99
  Next Steps
98
100
  ~~~~~~~~~~
99
101
 
100
- - Read the `Client Library Documentation`_ for Model Armor API
102
+ - Read the `Client Library Documentation`_ for Model Armor
101
103
  to see other available methods on the client.
102
- - Read the `Model Armor API Product documentation`_ to learn
104
+ - Read the `Model Armor Product documentation`_ to learn
103
105
  more about the product and see How-to Guides.
104
106
  - View this `README`_ to see the full list of Cloud
105
107
  APIs that we cover.
106
108
 
107
- .. _Model Armor API Product documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
109
+ .. _Model Armor Product documentation: https://cloud.google.com/security-command-center/
108
110
  .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
109
111
 
110
112
  Logging
@@ -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.4.0" # {x-release-please-version}
16
+ __version__ = "0.6.0" # {x-release-please-version}
@@ -28,6 +28,7 @@ else: # pragma: NO COVER
28
28
  # this code path once we drop support for Python 3.7
29
29
  import importlib_metadata as metadata
30
30
 
31
+
31
32
  from .services.model_armor import ModelArmorAsyncClient, ModelArmorClient
32
33
  from .types.service import (
33
34
  AiPlatformFloorSetting,
@@ -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.4.0" # {x-release-please-version}
16
+ __version__ = "0.6.0" # {x-release-please-version}
@@ -13,9 +13,9 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- from collections import OrderedDict
17
16
  import logging as std_logging
18
17
  import re
18
+ from collections import OrderedDict
19
19
  from typing import (
20
20
  Callable,
21
21
  Dict,
@@ -29,13 +29,13 @@ from typing import (
29
29
  Union,
30
30
  )
31
31
 
32
+ import google.protobuf
32
33
  from google.api_core import exceptions as core_exceptions
33
34
  from google.api_core import gapic_v1
34
35
  from google.api_core import retry_async as retries
35
36
  from google.api_core.client_options import ClientOptions
36
37
  from google.auth import credentials as ga_credentials # type: ignore
37
38
  from google.oauth2 import service_account # type: ignore
38
- import google.protobuf
39
39
 
40
40
  from google.cloud.modelarmor_v1 import gapic_version as package_version
41
41
 
@@ -44,9 +44,9 @@ try:
44
44
  except AttributeError: # pragma: NO COVER
45
45
  OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
46
 
47
+ import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
48
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
47
49
  from google.cloud.location import locations_pb2 # type: ignore
48
- from google.protobuf import field_mask_pb2 # type: ignore
49
- from google.protobuf import timestamp_pb2 # type: ignore
50
50
 
51
51
  from google.cloud.modelarmor_v1.services.model_armor import pagers
52
52
  from google.cloud.modelarmor_v1.types import service
@@ -113,7 +113,10 @@ class ModelArmorAsyncClient:
113
113
  Returns:
114
114
  ModelArmorAsyncClient: The constructed client.
115
115
  """
116
- return ModelArmorClient.from_service_account_info.__func__(ModelArmorAsyncClient, info, *args, **kwargs) # type: ignore
116
+ sa_info_func = (
117
+ ModelArmorClient.from_service_account_info.__func__ # type: ignore
118
+ )
119
+ return sa_info_func(ModelArmorAsyncClient, info, *args, **kwargs)
117
120
 
118
121
  @classmethod
119
122
  def from_service_account_file(cls, filename: str, *args, **kwargs):
@@ -129,7 +132,10 @@ class ModelArmorAsyncClient:
129
132
  Returns:
130
133
  ModelArmorAsyncClient: The constructed client.
131
134
  """
132
- return ModelArmorClient.from_service_account_file.__func__(ModelArmorAsyncClient, filename, *args, **kwargs) # type: ignore
135
+ sa_file_func = (
136
+ ModelArmorClient.from_service_account_file.__func__ # type: ignore
137
+ )
138
+ return sa_file_func(ModelArmorAsyncClient, filename, *args, **kwargs)
133
139
 
134
140
  from_service_account_json = from_service_account_file
135
141
 
@@ -179,7 +185,7 @@ class ModelArmorAsyncClient:
179
185
  return self._client.transport
180
186
 
181
187
  @property
182
- def api_endpoint(self):
188
+ def api_endpoint(self) -> str:
183
189
  """Return the API endpoint used by the client instance.
184
190
 
185
191
  Returns:
@@ -1276,7 +1282,7 @@ class ModelArmorAsyncClient:
1276
1282
 
1277
1283
  async def get_location(
1278
1284
  self,
1279
- request: Optional[locations_pb2.GetLocationRequest] = None,
1285
+ request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
1280
1286
  *,
1281
1287
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
1282
1288
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -1302,8 +1308,12 @@ class ModelArmorAsyncClient:
1302
1308
  # Create or coerce a protobuf request object.
1303
1309
  # The request isn't a proto-plus wrapped type,
1304
1310
  # so it must be constructed via keyword expansion.
1305
- if isinstance(request, dict):
1306
- request = locations_pb2.GetLocationRequest(**request)
1311
+ if request is None:
1312
+ request_pb = locations_pb2.GetLocationRequest()
1313
+ elif isinstance(request, dict):
1314
+ request_pb = locations_pb2.GetLocationRequest(**request)
1315
+ else:
1316
+ request_pb = request
1307
1317
 
1308
1318
  # Wrap the RPC method; this adds retry and timeout information,
1309
1319
  # and friendly error handling.
@@ -1312,7 +1322,7 @@ class ModelArmorAsyncClient:
1312
1322
  # Certain fields should be provided within the metadata header;
1313
1323
  # add these here.
1314
1324
  metadata = tuple(metadata) + (
1315
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1325
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1316
1326
  )
1317
1327
 
1318
1328
  # Validate the universe domain.
@@ -1320,7 +1330,7 @@ class ModelArmorAsyncClient:
1320
1330
 
1321
1331
  # Send the request.
1322
1332
  response = await rpc(
1323
- request,
1333
+ request_pb,
1324
1334
  retry=retry,
1325
1335
  timeout=timeout,
1326
1336
  metadata=metadata,
@@ -1331,7 +1341,7 @@ class ModelArmorAsyncClient:
1331
1341
 
1332
1342
  async def list_locations(
1333
1343
  self,
1334
- request: Optional[locations_pb2.ListLocationsRequest] = None,
1344
+ request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None,
1335
1345
  *,
1336
1346
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
1337
1347
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -1357,8 +1367,12 @@ class ModelArmorAsyncClient:
1357
1367
  # Create or coerce a protobuf request object.
1358
1368
  # The request isn't a proto-plus wrapped type,
1359
1369
  # so it must be constructed via keyword expansion.
1360
- if isinstance(request, dict):
1361
- request = locations_pb2.ListLocationsRequest(**request)
1370
+ if request is None:
1371
+ request_pb = locations_pb2.ListLocationsRequest()
1372
+ elif isinstance(request, dict):
1373
+ request_pb = locations_pb2.ListLocationsRequest(**request)
1374
+ else:
1375
+ request_pb = request
1362
1376
 
1363
1377
  # Wrap the RPC method; this adds retry and timeout information,
1364
1378
  # and friendly error handling.
@@ -1367,7 +1381,7 @@ class ModelArmorAsyncClient:
1367
1381
  # Certain fields should be provided within the metadata header;
1368
1382
  # add these here.
1369
1383
  metadata = tuple(metadata) + (
1370
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1384
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1371
1385
  )
1372
1386
 
1373
1387
  # Validate the universe domain.
@@ -1375,7 +1389,7 @@ class ModelArmorAsyncClient:
1375
1389
 
1376
1390
  # Send the request.
1377
1391
  response = await rpc(
1378
- request,
1392
+ request_pb,
1379
1393
  retry=retry,
1380
1394
  timeout=timeout,
1381
1395
  metadata=metadata,
@@ -13,12 +13,13 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- from collections import OrderedDict
17
- from http import HTTPStatus
18
16
  import json
19
17
  import logging as std_logging
20
18
  import os
21
19
  import re
20
+ import warnings
21
+ from collections import OrderedDict
22
+ from http import HTTPStatus
22
23
  from typing import (
23
24
  Callable,
24
25
  Dict,
@@ -32,8 +33,8 @@ from typing import (
32
33
  Union,
33
34
  cast,
34
35
  )
35
- import warnings
36
36
 
37
+ import google.protobuf
37
38
  from google.api_core import client_options as client_options_lib
38
39
  from google.api_core import exceptions as core_exceptions
39
40
  from google.api_core import gapic_v1
@@ -43,7 +44,6 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore
43
44
  from google.auth.transport import mtls # type: ignore
44
45
  from google.auth.transport.grpc import SslCredentials # type: ignore
45
46
  from google.oauth2 import service_account # type: ignore
46
- import google.protobuf
47
47
 
48
48
  from google.cloud.modelarmor_v1 import gapic_version as package_version
49
49
 
@@ -61,9 +61,9 @@ except ImportError: # pragma: NO COVER
61
61
 
62
62
  _LOGGER = std_logging.getLogger(__name__)
63
63
 
64
+ import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
65
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
64
66
  from google.cloud.location import locations_pb2 # type: ignore
65
- from google.protobuf import field_mask_pb2 # type: ignore
66
- from google.protobuf import timestamp_pb2 # type: ignore
67
67
 
68
68
  from google.cloud.modelarmor_v1.services.model_armor import pagers
69
69
  from google.cloud.modelarmor_v1.types import service
@@ -113,7 +113,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
113
113
  """Service describing handlers for resources"""
114
114
 
115
115
  @staticmethod
116
- def _get_default_mtls_endpoint(api_endpoint):
116
+ def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
117
117
  """Converts api endpoint to mTLS endpoint.
118
118
 
119
119
  Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
@@ -121,7 +121,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
121
121
  Args:
122
122
  api_endpoint (Optional[str]): the api endpoint to convert.
123
123
  Returns:
124
- str: converted mTLS api endpoint.
124
+ Optional[str]: converted mTLS api endpoint.
125
125
  """
126
126
  if not api_endpoint:
127
127
  return api_endpoint
@@ -131,6 +131,10 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
131
131
  )
132
132
 
133
133
  m = mtls_endpoint_re.match(api_endpoint)
134
+ if m is None:
135
+ # Could not parse api_endpoint; return as-is.
136
+ return api_endpoint
137
+
134
138
  name, mtls, sandbox, googledomain = m.groups()
135
139
  if mtls or not googledomain:
136
140
  return api_endpoint
@@ -458,7 +462,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
458
462
  @staticmethod
459
463
  def _get_api_endpoint(
460
464
  api_override, client_cert_source, universe_domain, use_mtls_endpoint
461
- ):
465
+ ) -> str:
462
466
  """Return the API endpoint used by the client.
463
467
 
464
468
  Args:
@@ -555,7 +559,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
555
559
  error._details.append(json.dumps(cred_info))
556
560
 
557
561
  @property
558
- def api_endpoint(self):
562
+ def api_endpoint(self) -> str:
559
563
  """Return the API endpoint used by the client instance.
560
564
 
561
565
  Returns:
@@ -642,18 +646,16 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
642
646
 
643
647
  universe_domain_opt = getattr(self._client_options, "universe_domain", None)
644
648
 
645
- (
646
- self._use_client_cert,
647
- self._use_mtls_endpoint,
648
- self._universe_domain_env,
649
- ) = ModelArmorClient._read_environment_variables()
649
+ self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
650
+ ModelArmorClient._read_environment_variables()
651
+ )
650
652
  self._client_cert_source = ModelArmorClient._get_client_cert_source(
651
653
  self._client_options.client_cert_source, self._use_client_cert
652
654
  )
653
655
  self._universe_domain = ModelArmorClient._get_universe_domain(
654
656
  universe_domain_opt, self._universe_domain_env
655
657
  )
656
- self._api_endpoint = None # updated below, depending on `transport`
658
+ self._api_endpoint: str = "" # updated below, depending on `transport`
657
659
 
658
660
  # Initialize the universe domain validation.
659
661
  self._is_universe_domain_valid = False
@@ -681,8 +683,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
681
683
  )
682
684
  if self._client_options.scopes:
683
685
  raise ValueError(
684
- "When providing a transport instance, provide its scopes "
685
- "directly."
686
+ "When providing a transport instance, provide its scopes directly."
686
687
  )
687
688
  self._transport = cast(ModelArmorTransport, transport)
688
689
  self._api_endpoint = self._transport.host
@@ -1724,7 +1725,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1724
1725
 
1725
1726
  def get_location(
1726
1727
  self,
1727
- request: Optional[locations_pb2.GetLocationRequest] = None,
1728
+ request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
1728
1729
  *,
1729
1730
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
1730
1731
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -1750,8 +1751,12 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1750
1751
  # Create or coerce a protobuf request object.
1751
1752
  # The request isn't a proto-plus wrapped type,
1752
1753
  # so it must be constructed via keyword expansion.
1753
- if isinstance(request, dict):
1754
- request = locations_pb2.GetLocationRequest(**request)
1754
+ if request is None:
1755
+ request_pb = locations_pb2.GetLocationRequest()
1756
+ elif isinstance(request, dict):
1757
+ request_pb = locations_pb2.GetLocationRequest(**request)
1758
+ else:
1759
+ request_pb = request
1755
1760
 
1756
1761
  # Wrap the RPC method; this adds retry and timeout information,
1757
1762
  # and friendly error handling.
@@ -1760,7 +1765,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1760
1765
  # Certain fields should be provided within the metadata header;
1761
1766
  # add these here.
1762
1767
  metadata = tuple(metadata) + (
1763
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1768
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1764
1769
  )
1765
1770
 
1766
1771
  # Validate the universe domain.
@@ -1769,7 +1774,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1769
1774
  try:
1770
1775
  # Send the request.
1771
1776
  response = rpc(
1772
- request,
1777
+ request_pb,
1773
1778
  retry=retry,
1774
1779
  timeout=timeout,
1775
1780
  metadata=metadata,
@@ -1783,7 +1788,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1783
1788
 
1784
1789
  def list_locations(
1785
1790
  self,
1786
- request: Optional[locations_pb2.ListLocationsRequest] = None,
1791
+ request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None,
1787
1792
  *,
1788
1793
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
1789
1794
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -1809,8 +1814,12 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1809
1814
  # Create or coerce a protobuf request object.
1810
1815
  # The request isn't a proto-plus wrapped type,
1811
1816
  # so it must be constructed via keyword expansion.
1812
- if isinstance(request, dict):
1813
- request = locations_pb2.ListLocationsRequest(**request)
1817
+ if request is None:
1818
+ request_pb = locations_pb2.ListLocationsRequest()
1819
+ elif isinstance(request, dict):
1820
+ request_pb = locations_pb2.ListLocationsRequest(**request)
1821
+ else:
1822
+ request_pb = request
1814
1823
 
1815
1824
  # Wrap the RPC method; this adds retry and timeout information,
1816
1825
  # and friendly error handling.
@@ -1819,7 +1828,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1819
1828
  # Certain fields should be provided within the metadata header;
1820
1829
  # add these here.
1821
1830
  metadata = tuple(metadata) + (
1822
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1831
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1823
1832
  )
1824
1833
 
1825
1834
  # Validate the universe domain.
@@ -1828,7 +1837,7 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
1828
1837
  try:
1829
1838
  # Send the request.
1830
1839
  response = rpc(
1831
- request,
1840
+ request_pb,
1832
1841
  retry=retry,
1833
1842
  timeout=timeout,
1834
1843
  metadata=metadata,
@@ -67,7 +67,7 @@ class ListTemplatesPager:
67
67
  *,
68
68
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
69
69
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70
- metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
70
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
71
71
  ):
72
72
  """Instantiate the pager.
73
73
 
@@ -143,7 +143,7 @@ class ListTemplatesAsyncPager:
143
143
  *,
144
144
  retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
145
145
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
146
- metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
146
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
147
147
  ):
148
148
  """Instantiates the pager.
149
149
 
@@ -17,15 +17,15 @@ import abc
17
17
  from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
18
 
19
19
  import google.api_core
20
+ import google.auth # type: ignore
21
+ import google.protobuf
22
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
20
23
  from google.api_core import exceptions as core_exceptions
21
24
  from google.api_core import gapic_v1
22
25
  from google.api_core import retry as retries
23
- import google.auth # type: ignore
24
26
  from google.auth import credentials as ga_credentials # type: ignore
25
27
  from google.cloud.location import locations_pb2 # type: ignore
26
28
  from google.oauth2 import service_account # type: ignore
27
- import google.protobuf
28
- from google.protobuf import empty_pb2 # type: ignore
29
29
 
30
30
  from google.cloud.modelarmor_v1 import gapic_version as package_version
31
31
  from google.cloud.modelarmor_v1.types import service
@@ -82,10 +82,12 @@ class ModelArmorTransport(abc.ABC):
82
82
  your own client library.
83
83
  always_use_jwt_access (Optional[bool]): Whether self signed JWT should
84
84
  be used for service account credentials.
85
+ api_audience (Optional[str]): The intended audience for the API calls
86
+ to the service that will be set when using certain 3rd party
87
+ authentication flows. Audience is typically a resource identifier.
88
+ If not set, the host value will be used as a default.
85
89
  """
86
90
 
87
- scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
88
-
89
91
  # Save the scopes.
90
92
  self._scopes = scopes
91
93
  if not hasattr(self, "_ignore_credentials"):
@@ -100,11 +102,16 @@ class ModelArmorTransport(abc.ABC):
100
102
 
101
103
  if credentials_file is not None:
102
104
  credentials, _ = google.auth.load_credentials_from_file(
103
- credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
105
+ credentials_file,
106
+ scopes=scopes,
107
+ quota_project_id=quota_project_id,
108
+ default_scopes=self.AUTH_SCOPES,
104
109
  )
105
110
  elif credentials is None and not self._ignore_credentials:
106
111
  credentials, _ = google.auth.default(
107
- **scopes_kwargs, quota_project_id=quota_project_id
112
+ scopes=scopes,
113
+ quota_project_id=quota_project_id,
114
+ default_scopes=self.AUTH_SCOPES,
108
115
  )
109
116
  # Don't apply audience if the credentials file passed from user.
110
117
  if hasattr(credentials, "with_gdch_audience"):
@@ -128,6 +135,8 @@ class ModelArmorTransport(abc.ABC):
128
135
  host += ":443"
129
136
  self._host = host
130
137
 
138
+ self._wrapped_methods: Dict[Callable, Callable] = {}
139
+
131
140
  @property
132
141
  def host(self):
133
142
  return self._host