Skip to content

Commit d8d46a6

Browse files
chore: add autogenerated samples for functions v1/v2 (#11435)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent eba8805 commit d8d46a6

43 files changed

Lines changed: 5112 additions & 3 deletions

File tree

Some content is hidden

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

packages/google-cloud-functions/google/cloud/functions/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.13.0" # {x-release-please-version}
16+
__version__ = "0.1.0" # {x-release-please-version}

packages/google-cloud-functions/google/cloud/functions_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.13.0" # {x-release-please-version}
16+
__version__ = "0.1.0" # {x-release-please-version}

packages/google-cloud-functions/google/cloud/functions_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.13.0" # {x-release-please-version}
16+
__version__ = "0.1.0" # {x-release-please-version}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CallFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
async def sample_call_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceAsyncClient()
40+
41+
# Initialize request argument(s)
42+
request = functions_v1.CallFunctionRequest(
43+
name="name_value",
44+
data="data_value",
45+
)
46+
47+
# Make the request
48+
response = await client.call_function(request=request)
49+
50+
# Handle the response
51+
print(response)
52+
53+
# [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CallFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
def sample_call_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceClient()
40+
41+
# Initialize request argument(s)
42+
request = functions_v1.CallFunctionRequest(
43+
name="name_value",
44+
data="data_value",
45+
)
46+
47+
# Make the request
48+
response = client.call_function(request=request)
49+
50+
# Handle the response
51+
print(response)
52+
53+
# [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
async def sample_create_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceAsyncClient()
40+
41+
# Initialize request argument(s)
42+
function = functions_v1.CloudFunction()
43+
function.source_archive_url = "source_archive_url_value"
44+
45+
request = functions_v1.CreateFunctionRequest(
46+
location="location_value",
47+
function=function,
48+
)
49+
50+
# Make the request
51+
operation = client.create_function(request=request)
52+
53+
print("Waiting for operation to complete...")
54+
55+
response = (await operation).result()
56+
57+
# Handle the response
58+
print(response)
59+
60+
# [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
def sample_create_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceClient()
40+
41+
# Initialize request argument(s)
42+
function = functions_v1.CloudFunction()
43+
function.source_archive_url = "source_archive_url_value"
44+
45+
request = functions_v1.CreateFunctionRequest(
46+
location="location_value",
47+
function=function,
48+
)
49+
50+
# Make the request
51+
operation = client.create_function(request=request)
52+
53+
print("Waiting for operation to complete...")
54+
55+
response = operation.result()
56+
57+
# Handle the response
58+
print(response)
59+
60+
# [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for DeleteFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
async def sample_delete_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceAsyncClient()
40+
41+
# Initialize request argument(s)
42+
request = functions_v1.DeleteFunctionRequest(
43+
name="name_value",
44+
)
45+
46+
# Make the request
47+
operation = client.delete_function(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = (await operation).result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for DeleteFunction
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-functions
24+
25+
26+
# [START cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import functions_v1
35+
36+
37+
def sample_delete_function():
38+
# Create a client
39+
client = functions_v1.CloudFunctionsServiceClient()
40+
41+
# Initialize request argument(s)
42+
request = functions_v1.DeleteFunctionRequest(
43+
name="name_value",
44+
)
45+
46+
# Make the request
47+
operation = client.delete_function(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync]

0 commit comments

Comments
 (0)