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

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: use gapic-generator-python 0.53.4 (#48)
- [ ] 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 f160d29 commit f4ef191
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 150 deletions.
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # 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_management_v1.services.reachability_service import pagers
Expand Down Expand Up @@ -184,17 +186,17 @@ def __init__(

async def list_connectivity_tests(
self,
request: reachability.ListConnectivityTestsRequest = None,
request: Union[reachability.ListConnectivityTestsRequest, 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.ListConnectivityTestsAsyncPager:
r"""Lists all Connectivity Tests owned by a project.
Args:
request (:class:`google.cloud.network_management_v1.types.ListConnectivityTestsRequest`):
request (Union[google.cloud.network_management_v1.types.ListConnectivityTestsRequest, dict]):
The request object. Request for the
`ListConnectivityTests` method.
parent (:class:`str`):
Expand Down Expand Up @@ -263,17 +265,17 @@ async def list_connectivity_tests(

async def get_connectivity_test(
self,
request: reachability.GetConnectivityTestRequest = None,
request: Union[reachability.GetConnectivityTestRequest, 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]] = (),
) -> connectivity_test.ConnectivityTest:
r"""Gets the details of a specific Connectivity Test.
Args:
request (:class:`google.cloud.network_management_v1.types.GetConnectivityTestRequest`):
request (Union[google.cloud.network_management_v1.types.GetConnectivityTestRequest, dict]):
The request object. Request for the
`GetConnectivityTest` method.
name (:class:`str`):
Expand Down Expand Up @@ -335,12 +337,12 @@ async def get_connectivity_test(

async def create_connectivity_test(
self,
request: reachability.CreateConnectivityTestRequest = None,
request: Union[reachability.CreateConnectivityTestRequest, dict] = None,
*,
parent: str = None,
test_id: str = None,
resource: connectivity_test.ConnectivityTest = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -360,7 +362,7 @@ async def create_connectivity_test(
documentation.
Args:
request (:class:`google.cloud.network_management_v1.types.CreateConnectivityTestRequest`):
request (Union[google.cloud.network_management_v1.types.CreateConnectivityTestRequest, dict]):
The request object. Request for the
`CreateConnectivityTest` method.
parent (:class:`str`):
Expand Down Expand Up @@ -455,11 +457,11 @@ async def create_connectivity_test(

async def update_connectivity_test(
self,
request: reachability.UpdateConnectivityTestRequest = None,
request: Union[reachability.UpdateConnectivityTestRequest, dict] = None,
*,
update_mask: field_mask_pb2.FieldMask = None,
resource: connectivity_test.ConnectivityTest = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -481,7 +483,7 @@ async def update_connectivity_test(
for more details.
Args:
request (:class:`google.cloud.network_management_v1.types.UpdateConnectivityTestRequest`):
request (Union[google.cloud.network_management_v1.types.UpdateConnectivityTestRequest, dict]):
The request object. Request for the
`UpdateConnectivityTest` method.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Expand Down Expand Up @@ -565,9 +567,9 @@ async def update_connectivity_test(

async def rerun_connectivity_test(
self,
request: reachability.RerunConnectivityTestRequest = None,
request: Union[reachability.RerunConnectivityTestRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -587,7 +589,7 @@ async def rerun_connectivity_test(
returns a value of ``UNKNOWN``.
Args:
request (:class:`google.cloud.network_management_v1.types.RerunConnectivityTestRequest`):
request (Union[google.cloud.network_management_v1.types.RerunConnectivityTestRequest, dict]):
The request object. Request for the
`RerunConnectivityTest` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -638,17 +640,17 @@ async def rerun_connectivity_test(

async def delete_connectivity_test(
self,
request: reachability.DeleteConnectivityTestRequest = None,
request: Union[reachability.DeleteConnectivityTestRequest, 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_async.AsyncOperation:
r"""Deletes a specific ``ConnectivityTest``.
Args:
request (:class:`google.cloud.network_management_v1.types.DeleteConnectivityTestRequest`):
request (Union[google.cloud.network_management_v1.types.DeleteConnectivityTestRequest, dict]):
The request object. Request for the
`DeleteConnectivityTest` method.
name (:class:`str`):
Expand Down
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_management_v1.services.reachability_service import pagers
Expand Down Expand Up @@ -370,7 +372,7 @@ def list_connectivity_tests(
request: Union[reachability.ListConnectivityTestsRequest, 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.ListConnectivityTestsPager:
Expand Down Expand Up @@ -449,7 +451,7 @@ def get_connectivity_test(
request: Union[reachability.GetConnectivityTestRequest, 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]] = (),
) -> connectivity_test.ConnectivityTest:
Expand Down Expand Up @@ -523,7 +525,7 @@ def create_connectivity_test(
parent: str = None,
test_id: str = None,
resource: connectivity_test.ConnectivityTest = 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 @@ -642,7 +644,7 @@ def update_connectivity_test(
*,
update_mask: field_mask_pb2.FieldMask = None,
resource: connectivity_test.ConnectivityTest = 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 @@ -750,7 +752,7 @@ def rerun_connectivity_test(
self,
request: Union[reachability.RerunConnectivityTestRequest, dict] = 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 @@ -825,7 +827,7 @@ def delete_connectivity_test(
request: Union[reachability.DeleteConnectivityTestRequest, 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 All @@ -40,15 +39,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 ReachabilityServiceTransport(abc.ABC):
"""Abstract transport class for ReachabilityService."""
Expand Down Expand Up @@ -98,7 +88,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 @@ -131,29 +121,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 @@ -199,7 +166,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 @@ -122,7 +122,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 @@ -169,7 +168,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
22 changes: 22 additions & 0 deletions google/cloud/network_management_v1/types/trace.py
Expand Up @@ -81,6 +81,13 @@ class Step(proto.Message):
Each step has a well-defined state and an associated
configuration.
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:
description (str):
A description of the step. Usually this is a
Expand All @@ -97,49 +104,64 @@ class Step(proto.Message):
instance (google.cloud.network_management_v1.types.InstanceInfo):
Display information of a Compute Engine
instance.
This field is a member of `oneof`_ ``step_info``.
firewall (google.cloud.network_management_v1.types.FirewallInfo):
Display information of a Compute Engine
firewall rule.
This field is a member of `oneof`_ ``step_info``.
route (google.cloud.network_management_v1.types.RouteInfo):
Display information of a Compute Engine
route.
This field is a member of `oneof`_ ``step_info``.
endpoint (google.cloud.network_management_v1.types.EndpointInfo):
Display information of the source and
destination under analysis. The endpoint
information in an intermediate state may differ
with the initial input, as it might be modified
by state like NAT, or Connection Proxy.
This field is a member of `oneof`_ ``step_info``.
forwarding_rule (google.cloud.network_management_v1.types.ForwardingRuleInfo):
Display information of a Compute Engine
forwarding rule.
This field is a member of `oneof`_ ``step_info``.
vpn_gateway (google.cloud.network_management_v1.types.VpnGatewayInfo):
Display information of a Compute Engine VPN
gateway.
This field is a member of `oneof`_ ``step_info``.
vpn_tunnel (google.cloud.network_management_v1.types.VpnTunnelInfo):
Display information of a Compute Engine VPN
tunnel.
This field is a member of `oneof`_ ``step_info``.
deliver (google.cloud.network_management_v1.types.DeliverInfo):
Display information of the final state
"deliver" and reason.
This field is a member of `oneof`_ ``step_info``.
forward (google.cloud.network_management_v1.types.ForwardInfo):
Display information of the final state
"forward" and reason.
This field is a member of `oneof`_ ``step_info``.
abort (google.cloud.network_management_v1.types.AbortInfo):
Display information of the final state
"abort" and reason.
This field is a member of `oneof`_ ``step_info``.
drop (google.cloud.network_management_v1.types.DropInfo):
Display information of the final state "drop"
and reason.
This field is a member of `oneof`_ ``step_info``.
load_balancer (google.cloud.network_management_v1.types.LoadBalancerInfo):
Display information of the load balancers.
This field is a member of `oneof`_ ``step_info``.
network (google.cloud.network_management_v1.types.NetworkInfo):
Display information of a Google Cloud
network.
This field is a member of `oneof`_ ``step_info``.
gke_master (google.cloud.network_management_v1.types.GKEMasterInfo):
Display information of a Google Kubernetes
Engine cluster master.
This field is a member of `oneof`_ ``step_info``.
cloud_sql_instance (google.cloud.network_management_v1.types.CloudSQLInstanceInfo):
Display information of a Cloud SQL instance.
This field is a member of `oneof`_ ``step_info``.
"""

class State(proto.Enum):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -29,9 +29,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

0 comments on commit f4ef191

Please sign in to comment.