Google Cloud Functions is used to deploy functions that are executed by Google in response to various events.
Data connected with that event is passed to a function as the input data.
A function is a resource which describes a function that should be executed and how it is triggered.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
FunctionServiceClient(FunctionServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
FunctionServiceClient const &
|
FunctionServiceClient(FunctionServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
FunctionServiceClient &&
|
FunctionServiceClient(std::shared_ptr< FunctionServiceConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< FunctionServiceConnection >
|
opts |
Options
|
Operators
operator=(FunctionServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
FunctionServiceClient const &
|
Returns | |
---|---|
Type | Description |
FunctionServiceClient & |
operator=(FunctionServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
FunctionServiceClient &&
|
Returns | |
---|---|
Type | Description |
FunctionServiceClient & |
Functions
GetFunction(std::string const &, Options)
Returns a function with the given name from the requested project.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the function which details should be obtained. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::Function > |
the result of the RPC. The response message type (google.cloud.functions.v2.Function) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetFunction(google::cloud::functions::v2::GetFunctionRequest const &, Options)
Returns a function with the given name from the requested project.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::GetFunctionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::Function > |
the result of the RPC. The response message type (google.cloud.functions.v2.Function) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListFunctions(std::string const &, Options)
Returns a list of functions that belong to the requested project.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project and location from which the function should be listed, specified in the format |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::functions::v2::Function > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListFunctions(google::cloud::functions::v2::ListFunctionsRequest, Options)
Returns a list of functions that belong to the requested project.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::ListFunctionsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::functions::v2::Function > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
CreateFunction(std::string const &, google::cloud::functions::v2::Function const &, std::string const &, Options)
Creates a new function.
If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS
error.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project and location in which the function should be created, specified in the format |
function |
google::cloud::functions::v2::Function const &
Required. Function to be created. |
function_id |
std::string const &
The ID to use for the function, which will become the final component of the function's resource name. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
A |
CreateFunction(NoAwaitTag, std::string const &, google::cloud::functions::v2::Function const &, std::string const &, Options)
Creates a new function.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
parent |
std::string const &
|
function |
google::cloud::functions::v2::Function const &
|
function_id |
std::string const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateFunction(google::cloud::functions::v2::CreateFunctionRequest const &, Options)
Creates a new function.
If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS
error.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::CreateFunctionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
A |
CreateFunction(NoAwaitTag, google::cloud::functions::v2::CreateFunctionRequest const &, Options)
Creates a new function.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
request |
google::cloud::functions::v2::CreateFunctionRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateFunction(google::longrunning::Operation const &, Options)
Creates a new function.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
UpdateFunction(google::cloud::functions::v2::Function const &, google::protobuf::FieldMask const &, Options)
Updates existing function.
Parameters | |
---|---|
Name | Description |
function |
google::cloud::functions::v2::Function const &
Required. New version of the function. |
update_mask |
google::protobuf::FieldMask const &
The list of fields to be updated. If no field mask is provided, all fields will be updated. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
A |
UpdateFunction(NoAwaitTag, google::cloud::functions::v2::Function const &, google::protobuf::FieldMask const &, Options)
Updates existing function.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
function |
google::cloud::functions::v2::Function const &
|
update_mask |
google::protobuf::FieldMask const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateFunction(google::cloud::functions::v2::UpdateFunctionRequest const &, Options)
Updates existing function.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::UpdateFunctionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
A |
UpdateFunction(NoAwaitTag, google::cloud::functions::v2::UpdateFunctionRequest const &, Options)
Updates existing function.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
request |
google::cloud::functions::v2::UpdateFunctionRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateFunction(google::longrunning::Operation const &, Options)
Updates existing function.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::Function > > |
DeleteFunction(std::string const &, Options)
Deletes a function with the given name from the specified project.
If the given function is used by some trigger, the trigger will be updated to remove this function.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the function which should be deleted. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::OperationMetadata > > |
A |
DeleteFunction(NoAwaitTag, std::string const &, Options)
Deletes a function with the given name from the specified project.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
name |
std::string const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
DeleteFunction(google::cloud::functions::v2::DeleteFunctionRequest const &, Options)
Deletes a function with the given name from the specified project.
If the given function is used by some trigger, the trigger will be updated to remove this function.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::DeleteFunctionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::OperationMetadata > > |
A |
DeleteFunction(NoAwaitTag, google::cloud::functions::v2::DeleteFunctionRequest const &, Options)
Deletes a function with the given name from the specified project.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
NoAwaitTag
|
request |
google::cloud::functions::v2::DeleteFunctionRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
DeleteFunction(google::longrunning::Operation const &, Options)
Deletes a function with the given name from the specified project.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::functions::v2::OperationMetadata > > |
GenerateUploadUrl(google::cloud::functions::v2::GenerateUploadUrlRequest const &, Options)
Returns a signed URL for uploading a function source code.
For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.
When uploading source code to the generated signed URL, please follow these restrictions:
- Source file type should be a zip file.
- No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.
When making a HTTP PUT request, specify this header:
content-type: application/zip
Do not specify this header:
Authorization: Bearer YOUR_TOKEN
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::GenerateUploadUrlRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::GenerateUploadUrlResponse > |
the result of the RPC. The response message type (google.cloud.functions.v2.GenerateUploadUrlResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GenerateDownloadUrl(google::cloud::functions::v2::GenerateDownloadUrlRequest const &, Options)
Returns a signed URL for downloading deployed function source code.
The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::GenerateDownloadUrlRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::GenerateDownloadUrlResponse > |
the result of the RPC. The response message type (google.cloud.functions.v2.GenerateDownloadUrlResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListRuntimes(std::string const &, Options)
Returns a list of runtimes that are supported for the requested project.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project and location from which the runtimes should be listed, specified in the format |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::ListRuntimesResponse > |
the result of the RPC. The response message type (google.cloud.functions.v2.ListRuntimesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListRuntimes(google::cloud::functions::v2::ListRuntimesRequest const &, Options)
Returns a list of runtimes that are supported for the requested project.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::functions::v2::ListRuntimesRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::functions::v2::ListRuntimesResponse > |
the result of the RPC. The response message type (google.cloud.functions.v2.ListRuntimesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |