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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#201)
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 b6ced63 commit c44582e
Show file tree
Hide file tree
Showing 192 changed files with 1,788 additions and 4,791 deletions.
58 changes: 30 additions & 28 deletions google/cloud/dialogflowcx_v3/services/agents/async_client.py
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.dialogflowcx_v3.services.agents import pagers
Expand Down Expand Up @@ -179,18 +181,18 @@ def __init__(

async def list_agents(
self,
request: agent.ListAgentsRequest = None,
request: Union[agent.ListAgentsRequest, 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.ListAgentsAsyncPager:
r"""Returns the list of all agents in the specified
location.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.ListAgentsRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.ListAgentsRequest, dict]):
The request object. The request message for
[Agents.ListAgents][google.cloud.dialogflow.cx.v3.Agents.ListAgents].
parent (:class:`str`):
Expand Down Expand Up @@ -260,17 +262,17 @@ async def list_agents(

async def get_agent(
self,
request: agent.GetAgentRequest = None,
request: Union[agent.GetAgentRequest, 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]] = (),
) -> agent.Agent:
r"""Retrieves the specified agent.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.GetAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.GetAgentRequest, dict]):
The request object. The request message for
[Agents.GetAgent][google.cloud.dialogflow.cx.v3.Agents.GetAgent].
name (:class:`str`):
Expand Down Expand Up @@ -343,11 +345,11 @@ async def get_agent(

async def create_agent(
self,
request: gcdc_agent.CreateAgentRequest = None,
request: Union[gcdc_agent.CreateAgentRequest, dict] = None,
*,
parent: str = None,
agent: gcdc_agent.Agent = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcdc_agent.Agent:
Expand All @@ -358,7 +360,7 @@ async def create_agent(
documentation <https://cloud.google.com/dialogflow/cx/docs/concept/training>`__.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.CreateAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.CreateAgentRequest, dict]):
The request object. The request message for
[Agents.CreateAgent][google.cloud.dialogflow.cx.v3.Agents.CreateAgent].
parent (:class:`str`):
Expand Down Expand Up @@ -438,11 +440,11 @@ async def create_agent(

async def update_agent(
self,
request: gcdc_agent.UpdateAgentRequest = None,
request: Union[gcdc_agent.UpdateAgentRequest, dict] = None,
*,
agent: gcdc_agent.Agent = 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]] = (),
) -> gcdc_agent.Agent:
Expand All @@ -453,7 +455,7 @@ async def update_agent(
documentation <https://cloud.google.com/dialogflow/cx/docs/concept/training>`__.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.UpdateAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.UpdateAgentRequest, dict]):
The request object. The request message for
[Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent].
agent (:class:`google.cloud.dialogflowcx_v3.types.Agent`):
Expand Down Expand Up @@ -536,17 +538,17 @@ async def update_agent(

async def delete_agent(
self,
request: agent.DeleteAgentRequest = None,
request: Union[agent.DeleteAgentRequest, 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]] = (),
) -> None:
r"""Deletes the specified agent.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.DeleteAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.DeleteAgentRequest, dict]):
The request object. The request message for
[Agents.DeleteAgent][google.cloud.dialogflow.cx.v3.Agents.DeleteAgent].
name (:class:`str`):
Expand Down Expand Up @@ -600,9 +602,9 @@ async def delete_agent(

async def export_agent(
self,
request: agent.ExportAgentRequest = None,
request: Union[agent.ExportAgentRequest, 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 @@ -619,7 +621,7 @@ async def export_agent(
[ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.ExportAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.ExportAgentRequest, dict]):
The request object. The request message for
[Agents.ExportAgent][google.cloud.dialogflow.cx.v3.Agents.ExportAgent].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -671,9 +673,9 @@ async def export_agent(

async def restore_agent(
self,
request: agent.RestoreAgentRequest = None,
request: Union[agent.RestoreAgentRequest, 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 @@ -698,7 +700,7 @@ async def restore_agent(
documentation <https://cloud.google.com/dialogflow/cx/docs/concept/training>`__.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.RestoreAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.RestoreAgentRequest, dict]):
The request object. The request message for
[Agents.RestoreAgent][google.cloud.dialogflow.cx.v3.Agents.RestoreAgent].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -759,9 +761,9 @@ async def restore_agent(

async def validate_agent(
self,
request: agent.ValidateAgentRequest = None,
request: Union[agent.ValidateAgentRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> agent.AgentValidationResult:
Expand All @@ -771,7 +773,7 @@ async def validate_agent(
completed to get the complete validation results.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.ValidateAgentRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.ValidateAgentRequest, dict]):
The request object. The request message for
[Agents.ValidateAgent][google.cloud.dialogflow.cx.v3.Agents.ValidateAgent].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -811,18 +813,18 @@ async def validate_agent(

async def get_agent_validation_result(
self,
request: agent.GetAgentValidationResultRequest = None,
request: Union[agent.GetAgentValidationResultRequest, 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]] = (),
) -> agent.AgentValidationResult:
r"""Gets the latest agent validation result. Agent
validation is performed when ValidateAgent is called.
Args:
request (:class:`google.cloud.dialogflowcx_v3.types.GetAgentValidationResultRequest`):
request (Union[google.cloud.dialogflowcx_v3.types.GetAgentValidationResultRequest, dict]):
The request object. The request message for
[Agents.GetAgentValidationResult][google.cloud.dialogflow.cx.v3.Agents.GetAgentValidationResult].
name (:class:`str`):
Expand Down
20 changes: 11 additions & 9 deletions google/cloud/dialogflowcx_v3/services/agents/client.py
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.dialogflowcx_v3.services.agents import pagers
Expand Down Expand Up @@ -444,7 +446,7 @@ def list_agents(
request: Union[agent.ListAgentsRequest, 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.ListAgentsPager:
Expand Down Expand Up @@ -525,7 +527,7 @@ def get_agent(
request: Union[agent.GetAgentRequest, 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]] = (),
) -> agent.Agent:
Expand Down Expand Up @@ -609,7 +611,7 @@ def create_agent(
*,
parent: str = None,
agent: gcdc_agent.Agent = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcdc_agent.Agent:
Expand Down Expand Up @@ -704,7 +706,7 @@ def update_agent(
*,
agent: gcdc_agent.Agent = 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]] = (),
) -> gcdc_agent.Agent:
Expand Down Expand Up @@ -801,7 +803,7 @@ def delete_agent(
request: Union[agent.DeleteAgentRequest, 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]] = (),
) -> None:
Expand Down Expand Up @@ -864,7 +866,7 @@ def export_agent(
self,
request: Union[agent.ExportAgentRequest, 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 @@ -936,7 +938,7 @@ def restore_agent(
self,
request: Union[agent.RestoreAgentRequest, 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 @@ -1025,7 +1027,7 @@ def validate_agent(
self,
request: Union[agent.ValidateAgentRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> agent.AgentValidationResult:
Expand Down Expand Up @@ -1079,7 +1081,7 @@ def get_agent_validation_result(
request: Union[agent.GetAgentValidationResultRequest, 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]] = (),
) -> agent.AgentValidationResult:
Expand Down
37 changes: 2 additions & 35 deletions google/cloud/dialogflowcx_v3/services/agents/transports/base.py
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 @@ -41,15 +40,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 AgentsTransport(abc.ABC):
"""Abstract transport class for Agents."""
Expand Down Expand Up @@ -102,7 +92,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 @@ -135,29 +125,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 @@ -202,7 +169,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 @@ -114,7 +114,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 @@ -161,7 +160,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

0 comments on commit c44582e

Please sign in to comment.