Skip to content

Commit

Permalink
feat: generate v2 (#195)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 459309277

Source-Link: googleapis/googleapis@2844793

Source-Link: googleapis/googleapis-gen@319987c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzE5OTg3Y2MwZTg3ODlhMzY4ZTM0ODgyMjcxYTkyYjA3MTdjOWM4ZiJ9

chore: use gapic-generator-python 1.1.1
PiperOrigin-RevId: 459095142

Source-Link: googleapis/googleapis@4f1be99

Source-Link: googleapis/googleapis-gen@ae686d9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9

feat: add audience parameter
PiperOrigin-RevId: 456827138

Source-Link: googleapis/googleapis@23f1a15

Source-Link: googleapis/googleapis-gen@4075a85
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9

fix(deps): require google-api-core>=1.32.0,>=2.8.0
  • Loading branch information
gcf-owl-bot[bot] authored Jul 14, 2022
1 parent 8fe2b4a commit 7a27ee1
Show file tree
Hide file tree
Showing 49 changed files with 14,011 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
- name: Report coverage results
run: |
coverage combine .coverage-results/.coverage*
coverage report --show-missing --fail-under=100
coverage report --show-missing --fail-under=99
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FunctionService
---------------------------------

.. automodule:: google.cloud.functions_v2.services.function_service
:members:
:inherited-members:

.. automodule:: google.cloud.functions_v2.services.function_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Services for Google Cloud Functions v2 API
==========================================
.. toctree::
:maxdepth: 2

function_service
7 changes: 7 additions & 0 deletions packages/google-cloud-functions/docs/functions_v2/types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Types for Google Cloud Functions v2 API
=======================================

.. automodule:: google.cloud.functions_v2.types
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions packages/google-cloud-functions/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

.. include:: multiprocessing.rst

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


API Reference
-------------
Expand All @@ -11,6 +14,14 @@ API Reference
functions_v1/services
functions_v1/types

API Reference
-------------
.. toctree::
:maxdepth: 2

functions_v2/services
functions_v2/types


Changelog
---------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def list_functions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -84,11 +85,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -109,6 +105,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

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

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -157,6 +158,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def __init__(
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -202,6 +203,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .services.function_service import FunctionServiceAsyncClient, FunctionServiceClient
from .types.functions import (
BuildConfig,
CreateFunctionRequest,
DeleteFunctionRequest,
Environment,
EventFilter,
EventTrigger,
Function,
GenerateDownloadUrlRequest,
GenerateDownloadUrlResponse,
GenerateUploadUrlRequest,
GenerateUploadUrlResponse,
GetFunctionRequest,
ListFunctionsRequest,
ListFunctionsResponse,
ListRuntimesRequest,
ListRuntimesResponse,
OperationMetadata,
RepoSource,
SecretEnvVar,
SecretVolume,
ServiceConfig,
Source,
SourceProvenance,
Stage,
StateMessage,
StorageSource,
UpdateFunctionRequest,
)

__all__ = (
"FunctionServiceAsyncClient",
"BuildConfig",
"CreateFunctionRequest",
"DeleteFunctionRequest",
"Environment",
"EventFilter",
"EventTrigger",
"Function",
"FunctionServiceClient",
"GenerateDownloadUrlRequest",
"GenerateDownloadUrlResponse",
"GenerateUploadUrlRequest",
"GenerateUploadUrlResponse",
"GetFunctionRequest",
"ListFunctionsRequest",
"ListFunctionsResponse",
"ListRuntimesRequest",
"ListRuntimesResponse",
"OperationMetadata",
"RepoSource",
"SecretEnvVar",
"SecretVolume",
"ServiceConfig",
"Source",
"SourceProvenance",
"Stage",
"StateMessage",
"StorageSource",
"UpdateFunctionRequest",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.functions_v2",
"protoPackage": "google.cloud.functions.v2",
"schema": "1.0",
"services": {
"FunctionService": {
"clients": {
"grpc": {
"libraryClient": "FunctionServiceClient",
"rpcs": {
"CreateFunction": {
"methods": [
"create_function"
]
},
"DeleteFunction": {
"methods": [
"delete_function"
]
},
"GenerateDownloadUrl": {
"methods": [
"generate_download_url"
]
},
"GenerateUploadUrl": {
"methods": [
"generate_upload_url"
]
},
"GetFunction": {
"methods": [
"get_function"
]
},
"ListFunctions": {
"methods": [
"list_functions"
]
},
"ListRuntimes": {
"methods": [
"list_runtimes"
]
},
"UpdateFunction": {
"methods": [
"update_function"
]
}
}
},
"grpc-async": {
"libraryClient": "FunctionServiceAsyncClient",
"rpcs": {
"CreateFunction": {
"methods": [
"create_function"
]
},
"DeleteFunction": {
"methods": [
"delete_function"
]
},
"GenerateDownloadUrl": {
"methods": [
"generate_download_url"
]
},
"GenerateUploadUrl": {
"methods": [
"generate_upload_url"
]
},
"GetFunction": {
"methods": [
"get_function"
]
},
"ListFunctions": {
"methods": [
"list_functions"
]
},
"ListRuntimes": {
"methods": [
"list_runtimes"
]
},
"UpdateFunction": {
"methods": [
"update_function"
]
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Marker file for PEP 561.
# The google-cloud-functions package uses inline types.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .async_client import FunctionServiceAsyncClient
from .client import FunctionServiceClient

__all__ = (
"FunctionServiceClient",
"FunctionServiceAsyncClient",
)
Loading

0 comments on commit 7a27ee1

Please sign in to comment.