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

Commit 10a61fa

Browse files
feat: generate v2 (#195)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 459309277 Source-Link: googleapis/googleapis@2844793 Source-Link: https://github.com/googleapis/googleapis-gen/commit/319987cc0e8789a368e34882271a92b0717c9c8f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzE5OTg3Y2MwZTg3ODlhMzY4ZTM0ODgyMjcxYTkyYjA3MTdjOWM4ZiJ9 chore: use gapic-generator-python 1.1.1 PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae686d9cde4fc3e36d0ac02efb8643b15890c1ed Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4075a8514f676691ec156688a5bbf183aa9893ce Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9 fix(deps): require google-api-core>=1.32.0,>=2.8.0
1 parent 37d8fa1 commit 10a61fa

File tree

49 files changed

+14011
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+14011
-23
lines changed

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
- name: Report coverage results
5555
run: |
5656
coverage combine .coverage-results/.coverage*
57-
coverage report --show-missing --fail-under=100
57+
coverage report --show-missing --fail-under=99
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FunctionService
2+
---------------------------------
3+
4+
.. automodule:: google.cloud.functions_v2.services.function_service
5+
:members:
6+
:inherited-members:
7+
8+
.. automodule:: google.cloud.functions_v2.services.function_service.pagers
9+
:members:
10+
:inherited-members:

docs/functions_v2/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Functions v2 API
2+
==========================================
3+
.. toctree::
4+
:maxdepth: 2
5+
6+
function_service

docs/functions_v2/types.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Types for Google Cloud Functions v2 API
2+
=======================================
3+
4+
.. automodule:: google.cloud.functions_v2.types
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
.. include:: multiprocessing.rst
44

5+
This package includes clients for multiple versions of Cloud Functions.
6+
By default, you will get version ``functions_v1``.
7+
58

69
API Reference
710
-------------
@@ -11,6 +14,14 @@ API Reference
1114
functions_v1/services
1215
functions_v1/types
1316

17+
API Reference
18+
-------------
19+
.. toctree::
20+
:maxdepth: 2
21+
22+
functions_v2/services
23+
functions_v2/types
24+
1425

1526
Changelog
1627
---------

google/cloud/functions_v1/services/cloud_functions_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ def __init__(
483483
quota_project_id=client_options.quota_project_id,
484484
client_info=client_info,
485485
always_use_jwt_access=True,
486+
api_audience=client_options.api_audience,
486487
)
487488

488489
def list_functions(

google/cloud/functions_v1/services/cloud_functions_service/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
quota_project_id: Optional[str] = None,
5858
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5959
always_use_jwt_access: Optional[bool] = False,
60+
api_audience: Optional[str] = None,
6061
**kwargs,
6162
) -> None:
6263
"""Instantiate the transport.
@@ -84,11 +85,6 @@ def __init__(
8485
be used for service account credentials.
8586
"""
8687

87-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
88-
if ":" not in host:
89-
host += ":443"
90-
self._host = host
91-
9288
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9389

9490
# Save the scopes.
@@ -109,6 +105,11 @@ def __init__(
109105
credentials, _ = google.auth.default(
110106
**scopes_kwargs, quota_project_id=quota_project_id
111107
)
108+
# Don't apply audience if the credentials file passed from user.
109+
if hasattr(credentials, "with_gdch_audience"):
110+
credentials = credentials.with_gdch_audience(
111+
api_audience if api_audience else host
112+
)
112113

113114
# If the credentials are service account credentials, then always try to use self signed JWT.
114115
if (
@@ -121,6 +122,11 @@ def __init__(
121122
# Save the credentials.
122123
self._credentials = credentials
123124

125+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
126+
if ":" not in host:
127+
host += ":443"
128+
self._host = host
129+
124130
def _prep_wrapped_messages(self, client_info):
125131
# Precompute the wrapped methods.
126132
self._wrapped_methods = {

google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
quota_project_id: Optional[str] = None,
6262
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6363
always_use_jwt_access: Optional[bool] = False,
64+
api_audience: Optional[str] = None,
6465
) -> None:
6566
"""Instantiate the transport.
6667
@@ -157,6 +158,7 @@ def __init__(
157158
quota_project_id=quota_project_id,
158159
client_info=client_info,
159160
always_use_jwt_access=always_use_jwt_access,
161+
api_audience=api_audience,
160162
)
161163

162164
if not self._grpc_channel:

google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def __init__(
106106
quota_project_id=None,
107107
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
108108
always_use_jwt_access: Optional[bool] = False,
109+
api_audience: Optional[str] = None,
109110
) -> None:
110111
"""Instantiate the transport.
111112
@@ -202,6 +203,7 @@ def __init__(
202203
quota_project_id=quota_project_id,
203204
client_info=client_info,
204205
always_use_jwt_access=always_use_jwt_access,
206+
api_audience=api_audience,
205207
)
206208

207209
if not self._grpc_channel:

google/cloud/functions_v2/__init__.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from .services.function_service import FunctionServiceAsyncClient, FunctionServiceClient
18+
from .types.functions import (
19+
BuildConfig,
20+
CreateFunctionRequest,
21+
DeleteFunctionRequest,
22+
Environment,
23+
EventFilter,
24+
EventTrigger,
25+
Function,
26+
GenerateDownloadUrlRequest,
27+
GenerateDownloadUrlResponse,
28+
GenerateUploadUrlRequest,
29+
GenerateUploadUrlResponse,
30+
GetFunctionRequest,
31+
ListFunctionsRequest,
32+
ListFunctionsResponse,
33+
ListRuntimesRequest,
34+
ListRuntimesResponse,
35+
OperationMetadata,
36+
RepoSource,
37+
SecretEnvVar,
38+
SecretVolume,
39+
ServiceConfig,
40+
Source,
41+
SourceProvenance,
42+
Stage,
43+
StateMessage,
44+
StorageSource,
45+
UpdateFunctionRequest,
46+
)
47+
48+
__all__ = (
49+
"FunctionServiceAsyncClient",
50+
"BuildConfig",
51+
"CreateFunctionRequest",
52+
"DeleteFunctionRequest",
53+
"Environment",
54+
"EventFilter",
55+
"EventTrigger",
56+
"Function",
57+
"FunctionServiceClient",
58+
"GenerateDownloadUrlRequest",
59+
"GenerateDownloadUrlResponse",
60+
"GenerateUploadUrlRequest",
61+
"GenerateUploadUrlResponse",
62+
"GetFunctionRequest",
63+
"ListFunctionsRequest",
64+
"ListFunctionsResponse",
65+
"ListRuntimesRequest",
66+
"ListRuntimesResponse",
67+
"OperationMetadata",
68+
"RepoSource",
69+
"SecretEnvVar",
70+
"SecretVolume",
71+
"ServiceConfig",
72+
"Source",
73+
"SourceProvenance",
74+
"Stage",
75+
"StateMessage",
76+
"StorageSource",
77+
"UpdateFunctionRequest",
78+
)

0 commit comments

Comments
 (0)