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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#47)
Browse files Browse the repository at this point in the history
- [ ] 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: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent 604ac0d commit 518f32b
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 186 deletions.

Large diffs are not rendered by default.

Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.network_security_v1beta1.services.network_security import pagers
Expand Down Expand Up @@ -412,7 +414,7 @@ def list_authorization_policies(
] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListAuthorizationPoliciesPager:
Expand Down Expand Up @@ -498,7 +500,7 @@ def get_authorization_policy(
request: Union[authorization_policy.GetAuthorizationPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> authorization_policy.AuthorizationPolicy:
Expand Down Expand Up @@ -579,7 +581,7 @@ def create_authorization_policy(
parent: str = None,
authorization_policy: gcn_authorization_policy.AuthorizationPolicy = None,
authorization_policy_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -695,7 +697,7 @@ def update_authorization_policy(
*,
authorization_policy: gcn_authorization_policy.AuthorizationPolicy = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -802,7 +804,7 @@ def delete_authorization_policy(
] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -899,7 +901,7 @@ def list_server_tls_policies(
request: Union[server_tls_policy.ListServerTlsPoliciesRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServerTlsPoliciesPager:
Expand Down Expand Up @@ -981,7 +983,7 @@ def get_server_tls_policy(
request: Union[server_tls_policy.GetServerTlsPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> server_tls_policy.ServerTlsPolicy:
Expand Down Expand Up @@ -1060,7 +1062,7 @@ def create_server_tls_policy(
parent: str = None,
server_tls_policy: gcn_server_tls_policy.ServerTlsPolicy = None,
server_tls_policy_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1168,7 +1170,7 @@ def update_server_tls_policy(
*,
server_tls_policy: gcn_server_tls_policy.ServerTlsPolicy = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1268,7 +1270,7 @@ def delete_server_tls_policy(
request: Union[server_tls_policy.DeleteServerTlsPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1361,7 +1363,7 @@ def list_client_tls_policies(
request: Union[client_tls_policy.ListClientTlsPoliciesRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListClientTlsPoliciesPager:
Expand Down Expand Up @@ -1443,7 +1445,7 @@ def get_client_tls_policy(
request: Union[client_tls_policy.GetClientTlsPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> client_tls_policy.ClientTlsPolicy:
Expand Down Expand Up @@ -1521,7 +1523,7 @@ def create_client_tls_policy(
parent: str = None,
client_tls_policy: gcn_client_tls_policy.ClientTlsPolicy = None,
client_tls_policy_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1628,7 +1630,7 @@ def update_client_tls_policy(
*,
client_tls_policy: gcn_client_tls_policy.ClientTlsPolicy = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1727,7 +1729,7 @@ def delete_client_tls_policy(
request: Union[client_tls_policy.DeleteClientTlsPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand Down Expand Up @@ -50,15 +49,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class NetworkSecurityTransport(abc.ABC):
"""Abstract transport class for NetworkSecurity."""
Expand Down Expand Up @@ -108,7 +98,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -141,29 +131,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down Expand Up @@ -254,7 +221,7 @@ def close(self):
raise NotImplementedError()

@property
def operations_client(self) -> operations_v1.OperationsClient:
def operations_client(self):
"""Return the client designed to process long-running operations."""
raise NotImplementedError()

Expand Down
Expand Up @@ -121,7 +121,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Expand Up @@ -21,7 +21,6 @@
from google.api_core import operations_v1 # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down Expand Up @@ -168,7 +167,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Expand Up @@ -142,6 +142,8 @@ class Destination(proto.Message):
class HttpHeaderMatch(proto.Message):
r"""Specification of HTTP header match atrributes.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
regex_match (str):
Required. The value of the header must match
Expand All @@ -152,6 +154,7 @@ class HttpHeaderMatch(proto.Message):
request, use a headerMatch with headerName set
to Host and a regular expression that satisfies
the RFC2616 Host header's port specifier.
This field is a member of `oneof`_ ``type``.
header_name (str):
Required. The name of the HTTP header to
match. For matching against the HTTP request's
Expand Down
18 changes: 18 additions & 0 deletions google/cloud/network_security_v1beta1/types/tls.py
Expand Up @@ -45,15 +45,24 @@ class ValidationCA(proto.Message):
obtain the Certificate Authority certificate to validate the
peer certificate.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
grpc_endpoint (google.cloud.network_security_v1beta1.types.GrpcEndpoint):
gRPC specific configuration to access the
gRPC server to obtain the CA certificate.
This field is a member of `oneof`_ ``type``.
certificate_provider_instance (google.cloud.network_security_v1beta1.types.CertificateProviderInstance):
The certificate provider instance
specification that will be passed to the data
plane, which will be used to load necessary
credential information.
This field is a member of `oneof`_ ``type``.
"""

grpc_endpoint = proto.Field(
Expand Down Expand Up @@ -88,15 +97,24 @@ class CertificateProvider(proto.Message):
to obtain the certificate and private key for peer to peer
authentication.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
grpc_endpoint (google.cloud.network_security_v1beta1.types.GrpcEndpoint):
gRPC specific configuration to access the
gRPC server to obtain the cert and private key.
This field is a member of `oneof`_ ``type``.
certificate_provider_instance (google.cloud.network_security_v1beta1.types.CertificateProviderInstance):
The certificate provider instance
specification that will be passed to the data
plane, which will be used to load necessary
credential information.
This field is a member of `oneof`_ ``type``.
"""

grpc_endpoint = proto.Field(
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -28,9 +28,8 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Expand Up @@ -4,7 +4,5 @@
# Pin the version to the lower bound.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.26.0
google-api-core==1.28.0
proto-plus==1.15.0
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-api-core

0 comments on commit 518f32b

Please sign in to comment.