Skip to content

Commit

Permalink
Merge branch 'master' into iss-794
Browse files Browse the repository at this point in the history
  • Loading branch information
software-dov authored Mar 19, 2021
2 parents 3993e65 + 20b8f71 commit 1302d6a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class {{ service.name }}Transport(abc.ABC):
scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES,
quota_project_id: typing.Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
**kwargs,
**kwargs,
) -> None:
"""Instantiate the transport.

Expand All @@ -69,10 +69,10 @@ class {{ service.name }}Transport(abc.ABC):
scope (Optional[Sequence[str]]): A list of scopes.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
"""
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
Expand All @@ -87,7 +87,7 @@ class {{ service.name }}Transport(abc.ABC):
# defaults.
if credentials and credentials_file:
raise exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive")

if credentials_file is not None:
credentials, _ = auth.load_credentials_from_file(
credentials_file,
Expand Down Expand Up @@ -178,7 +178,7 @@ class {{ service.name }}Transport(abc.ABC):
],
]:
raise NotImplementedError()
{% endif %}
{% endif %}

__all__ = (
'{{ service.name }}Transport',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None

else:
if api_mtls_endpoint:
host = api_mtls_endpoint
Expand All @@ -133,14 +133,14 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
)
else:
self._ssl_channel_credentials = SslCredentials().ssl_credentials

else:
if client_cert_source_for_mtls and not ssl_channel_credentials:
cert, key = client_cert_source_for_mtls()
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
certificate_chain=cert, private_key=key
)

# The base transport sets the host, credentials and scopes
super().__init__(
host=host,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
If provided, it overrides the ``host`` argument and tries to create
a mutual TLS channel with client SSL credentials from
``client_cert_source`` or applicatin default SSL credentials.
client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
Deprecated. A callback to provide client SSL certificate bytes and
private key bytes, both in PEM format. It is ignored if
``api_mtls_endpoint`` is None.
Expand All @@ -133,10 +133,10 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.

Raises:
Expand All @@ -151,7 +151,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
{%- if service.has_lro %}
self._operations_client = None
{%- endif %}

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
if client_cert_source:
Expand All @@ -177,7 +177,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
)
else:
self._ssl_channel_credentials = SslCredentials().ssl_credentials

else:
if client_cert_source_for_mtls and not ssl_channel_credentials:
cert, key = client_cert_source_for_mtls()
Expand Down Expand Up @@ -351,7 +351,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
response_deserializer=iam_policy.TestIamPermissionsResponse.FromString,
)
return self._stubs["test_iam_permissions"]
{% endif %}
{% endif %}

__all__ = (
'{{ service.name }}GrpcAsyncIOTransport',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class {{ service.name }}RestTransport({{ service.name }}Transport):
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.

credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
Expand All @@ -73,10 +73,10 @@ class {{ service.name }}RestTransport({{ service.name }}Transport):
if ``channel`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
"""
# Run the base constructor
Expand All @@ -95,7 +95,7 @@ class {{ service.name }}RestTransport({{ service.name }}Transport):
self._prep_wrapped_messages(client_info)

{%- if service.has_lro %}

@property
def operations_client(self) -> operations_v1.OperationsClient:
"""Create the client designed to process long-running operations.
Expand Down Expand Up @@ -147,7 +147,7 @@ class {{ service.name }}RestTransport({{ service.name }}Transport):
{%- endif %}
"""

{# TODO(yon-mg): refactor when implementing grpc transcoding
{# TODO(yon-mg): refactor when implementing grpc transcoding
- parse request pb & assign body, path params
- shove leftovers into query params
- make sure dotted nested fields preserved
Expand Down

0 comments on commit 1302d6a

Please sign in to comment.