Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 518f32b

Browse files
chore: use gapic-generator-python 0.53.4 (#47)
- [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: googleapis/googleapis@83d81b0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
1 parent 604ac0d commit 518f32b

10 files changed

Lines changed: 109 additions & 186 deletions

File tree

‎google/cloud/network_security_v1beta1/services/network_security/async_client.py‎

Lines changed: 56 additions & 46 deletions
Large diffs are not rendered by default.

‎google/cloud/network_security_v1beta1/services/network_security/client.py‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from google.auth.exceptions import MutualTLSChannelError # type: ignore
3131
from google.oauth2 import service_account # type: ignore
3232

33+
OptionalRetry = Union[retries.Retry, object]
34+
3335
from google.api_core import operation # type: ignore
3436
from google.api_core import operation_async # type: ignore
3537
from google.cloud.network_security_v1beta1.services.network_security import pagers
@@ -412,7 +414,7 @@ def list_authorization_policies(
412414
] = None,
413415
*,
414416
parent: str = None,
415-
retry: retries.Retry = gapic_v1.method.DEFAULT,
417+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
416418
timeout: float = None,
417419
metadata: Sequence[Tuple[str, str]] = (),
418420
) -> pagers.ListAuthorizationPoliciesPager:
@@ -498,7 +500,7 @@ def get_authorization_policy(
498500
request: Union[authorization_policy.GetAuthorizationPolicyRequest, dict] = None,
499501
*,
500502
name: str = None,
501-
retry: retries.Retry = gapic_v1.method.DEFAULT,
503+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
502504
timeout: float = None,
503505
metadata: Sequence[Tuple[str, str]] = (),
504506
) -> authorization_policy.AuthorizationPolicy:
@@ -579,7 +581,7 @@ def create_authorization_policy(
579581
parent: str = None,
580582
authorization_policy: gcn_authorization_policy.AuthorizationPolicy = None,
581583
authorization_policy_id: str = None,
582-
retry: retries.Retry = gapic_v1.method.DEFAULT,
584+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
583585
timeout: float = None,
584586
metadata: Sequence[Tuple[str, str]] = (),
585587
) -> operation.Operation:
@@ -695,7 +697,7 @@ def update_authorization_policy(
695697
*,
696698
authorization_policy: gcn_authorization_policy.AuthorizationPolicy = None,
697699
update_mask: field_mask_pb2.FieldMask = None,
698-
retry: retries.Retry = gapic_v1.method.DEFAULT,
700+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
699701
timeout: float = None,
700702
metadata: Sequence[Tuple[str, str]] = (),
701703
) -> operation.Operation:
@@ -802,7 +804,7 @@ def delete_authorization_policy(
802804
] = None,
803805
*,
804806
name: str = None,
805-
retry: retries.Retry = gapic_v1.method.DEFAULT,
807+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
806808
timeout: float = None,
807809
metadata: Sequence[Tuple[str, str]] = (),
808810
) -> operation.Operation:
@@ -899,7 +901,7 @@ def list_server_tls_policies(
899901
request: Union[server_tls_policy.ListServerTlsPoliciesRequest, dict] = None,
900902
*,
901903
parent: str = None,
902-
retry: retries.Retry = gapic_v1.method.DEFAULT,
904+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
903905
timeout: float = None,
904906
metadata: Sequence[Tuple[str, str]] = (),
905907
) -> pagers.ListServerTlsPoliciesPager:
@@ -981,7 +983,7 @@ def get_server_tls_policy(
981983
request: Union[server_tls_policy.GetServerTlsPolicyRequest, dict] = None,
982984
*,
983985
name: str = None,
984-
retry: retries.Retry = gapic_v1.method.DEFAULT,
986+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
985987
timeout: float = None,
986988
metadata: Sequence[Tuple[str, str]] = (),
987989
) -> server_tls_policy.ServerTlsPolicy:
@@ -1060,7 +1062,7 @@ def create_server_tls_policy(
10601062
parent: str = None,
10611063
server_tls_policy: gcn_server_tls_policy.ServerTlsPolicy = None,
10621064
server_tls_policy_id: str = None,
1063-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1065+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
10641066
timeout: float = None,
10651067
metadata: Sequence[Tuple[str, str]] = (),
10661068
) -> operation.Operation:
@@ -1168,7 +1170,7 @@ def update_server_tls_policy(
11681170
*,
11691171
server_tls_policy: gcn_server_tls_policy.ServerTlsPolicy = None,
11701172
update_mask: field_mask_pb2.FieldMask = None,
1171-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1173+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
11721174
timeout: float = None,
11731175
metadata: Sequence[Tuple[str, str]] = (),
11741176
) -> operation.Operation:
@@ -1268,7 +1270,7 @@ def delete_server_tls_policy(
12681270
request: Union[server_tls_policy.DeleteServerTlsPolicyRequest, dict] = None,
12691271
*,
12701272
name: str = None,
1271-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1273+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
12721274
timeout: float = None,
12731275
metadata: Sequence[Tuple[str, str]] = (),
12741276
) -> operation.Operation:
@@ -1361,7 +1363,7 @@ def list_client_tls_policies(
13611363
request: Union[client_tls_policy.ListClientTlsPoliciesRequest, dict] = None,
13621364
*,
13631365
parent: str = None,
1364-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1366+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
13651367
timeout: float = None,
13661368
metadata: Sequence[Tuple[str, str]] = (),
13671369
) -> pagers.ListClientTlsPoliciesPager:
@@ -1443,7 +1445,7 @@ def get_client_tls_policy(
14431445
request: Union[client_tls_policy.GetClientTlsPolicyRequest, dict] = None,
14441446
*,
14451447
name: str = None,
1446-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1448+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
14471449
timeout: float = None,
14481450
metadata: Sequence[Tuple[str, str]] = (),
14491451
) -> client_tls_policy.ClientTlsPolicy:
@@ -1521,7 +1523,7 @@ def create_client_tls_policy(
15211523
parent: str = None,
15221524
client_tls_policy: gcn_client_tls_policy.ClientTlsPolicy = None,
15231525
client_tls_policy_id: str = None,
1524-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1526+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
15251527
timeout: float = None,
15261528
metadata: Sequence[Tuple[str, str]] = (),
15271529
) -> operation.Operation:
@@ -1628,7 +1630,7 @@ def update_client_tls_policy(
16281630
*,
16291631
client_tls_policy: gcn_client_tls_policy.ClientTlsPolicy = None,
16301632
update_mask: field_mask_pb2.FieldMask = None,
1631-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1633+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
16321634
timeout: float = None,
16331635
metadata: Sequence[Tuple[str, str]] = (),
16341636
) -> operation.Operation:
@@ -1727,7 +1729,7 @@ def delete_client_tls_policy(
17271729
request: Union[client_tls_policy.DeleteClientTlsPolicyRequest, dict] = None,
17281730
*,
17291731
name: str = None,
1730-
retry: retries.Retry = gapic_v1.method.DEFAULT,
1732+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
17311733
timeout: float = None,
17321734
metadata: Sequence[Tuple[str, str]] = (),
17331735
) -> operation.Operation:

‎google/cloud/network_security_v1beta1/services/network_security/transports/base.py‎

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#
1616
import abc
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18-
import packaging.version
1918
import pkg_resources
2019

2120
import google.auth # type: ignore
@@ -50,15 +49,6 @@
5049
except pkg_resources.DistributionNotFound:
5150
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
5251

53-
try:
54-
# google.auth.__version__ was added in 1.26.0
55-
_GOOGLE_AUTH_VERSION = google.auth.__version__
56-
except AttributeError:
57-
try: # try pkg_resources if it is available
58-
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
59-
except pkg_resources.DistributionNotFound: # pragma: NO COVER
60-
_GOOGLE_AUTH_VERSION = None
61-
6252

6353
class NetworkSecurityTransport(abc.ABC):
6454
"""Abstract transport class for NetworkSecurity."""
@@ -108,7 +98,7 @@ def __init__(
10898
host += ":443"
10999
self._host = host
110100

111-
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
101+
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
112102

113103
# Save the scopes.
114104
self._scopes = scopes
@@ -141,29 +131,6 @@ def __init__(
141131
# Save the credentials.
142132
self._credentials = credentials
143133

144-
# TODO(busunkim): This method is in the base transport
145-
# to avoid duplicating code across the transport classes. These functions
146-
# should be deleted once the minimum required versions of google-auth is increased.
147-
148-
# TODO: Remove this function once google-auth >= 1.25.0 is required
149-
@classmethod
150-
def _get_scopes_kwargs(
151-
cls, host: str, scopes: Optional[Sequence[str]]
152-
) -> Dict[str, Optional[Sequence[str]]]:
153-
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""
154-
155-
scopes_kwargs = {}
156-
157-
if _GOOGLE_AUTH_VERSION and (
158-
packaging.version.parse(_GOOGLE_AUTH_VERSION)
159-
>= packaging.version.parse("1.25.0")
160-
):
161-
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
162-
else:
163-
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}
164-
165-
return scopes_kwargs
166-
167134
def _prep_wrapped_messages(self, client_info):
168135
# Precompute the wrapped methods.
169136
self._wrapped_methods = {
@@ -254,7 +221,7 @@ def close(self):
254221
raise NotImplementedError()
255222

256223
@property
257-
def operations_client(self) -> operations_v1.OperationsClient:
224+
def operations_client(self):
258225
"""Return the client designed to process long-running operations."""
259226
raise NotImplementedError()
260227

‎google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(
121121
self._grpc_channel = None
122122
self._ssl_channel_credentials = ssl_channel_credentials
123123
self._stubs: Dict[str, Callable] = {}
124-
self._operations_client = None
124+
self._operations_client: Optional[operations_v1.OperationsClient] = None
125125

126126
if api_mtls_endpoint:
127127
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)

‎google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from google.api_core import operations_v1 # type: ignore
2222
from google.auth import credentials as ga_credentials # type: ignore
2323
from google.auth.transport.grpc import SslCredentials # type: ignore
24-
import packaging.version
2524

2625
import grpc # type: ignore
2726
from grpc.experimental import aio # type: ignore
@@ -168,7 +167,7 @@ def __init__(
168167
self._grpc_channel = None
169168
self._ssl_channel_credentials = ssl_channel_credentials
170169
self._stubs: Dict[str, Callable] = {}
171-
self._operations_client = None
170+
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
172171

173172
if api_mtls_endpoint:
174173
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)

‎google/cloud/network_security_v1beta1/types/authorization_policy.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class Destination(proto.Message):
142142
class HttpHeaderMatch(proto.Message):
143143
r"""Specification of HTTP header match atrributes.
144144
145+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
146+
145147
Attributes:
146148
regex_match (str):
147149
Required. The value of the header must match
@@ -152,6 +154,7 @@ class HttpHeaderMatch(proto.Message):
152154
request, use a headerMatch with headerName set
153155
to Host and a regular expression that satisfies
154156
the RFC2616 Host header's port specifier.
157+
This field is a member of `oneof`_ ``type``.
155158
header_name (str):
156159
Required. The name of the HTTP header to
157160
match. For matching against the HTTP request's

‎google/cloud/network_security_v1beta1/types/tls.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,24 @@ class ValidationCA(proto.Message):
4545
obtain the Certificate Authority certificate to validate the
4646
peer certificate.
4747
48+
This message has `oneof`_ fields (mutually exclusive fields).
49+
For each oneof, at most one member field can be set at the same time.
50+
Setting any member of the oneof automatically clears all other
51+
members.
52+
53+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
54+
4855
Attributes:
4956
grpc_endpoint (google.cloud.network_security_v1beta1.types.GrpcEndpoint):
5057
gRPC specific configuration to access the
5158
gRPC server to obtain the CA certificate.
59+
This field is a member of `oneof`_ ``type``.
5260
certificate_provider_instance (google.cloud.network_security_v1beta1.types.CertificateProviderInstance):
5361
The certificate provider instance
5462
specification that will be passed to the data
5563
plane, which will be used to load necessary
5664
credential information.
65+
This field is a member of `oneof`_ ``type``.
5766
"""
5867

5968
grpc_endpoint = proto.Field(
@@ -88,15 +97,24 @@ class CertificateProvider(proto.Message):
8897
to obtain the certificate and private key for peer to peer
8998
authentication.
9099
100+
This message has `oneof`_ fields (mutually exclusive fields).
101+
For each oneof, at most one member field can be set at the same time.
102+
Setting any member of the oneof automatically clears all other
103+
members.
104+
105+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
106+
91107
Attributes:
92108
grpc_endpoint (google.cloud.network_security_v1beta1.types.GrpcEndpoint):
93109
gRPC specific configuration to access the
94110
gRPC server to obtain the cert and private key.
111+
This field is a member of `oneof`_ ``type``.
95112
certificate_provider_instance (google.cloud.network_security_v1beta1.types.CertificateProviderInstance):
96113
The certificate provider instance
97114
specification that will be passed to the data
98115
plane, which will be used to load necessary
99116
credential information.
117+
This field is a member of `oneof`_ ``type``.
100118
"""
101119

102120
grpc_endpoint = proto.Field(

‎setup.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
2929
# Until this issue is closed
3030
# https://github.com/googleapis/google-cloud-python/issues/10566
31-
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
31+
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
3232
"proto-plus >= 1.15.0",
33-
"packaging >= 14.3",
3433
]
3534

3635
package_root = os.path.abspath(os.path.dirname(__file__))

‎testing/constraints-3.6.txt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
# Pin the version to the lower bound.
55
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
66
# Then this file should have google-cloud-foo==1.14.0
7-
google-api-core==1.26.0
7+
google-api-core==1.28.0
88
proto-plus==1.15.0
9-
packaging==14.3
10-
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-api-core

0 commit comments

Comments
 (0)