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 |
ListLocations(google::cloud::location::ListLocationsRequest, Options)
Lists information about the supported locations for this service.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::location::ListLocationsRequest
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::location::Location > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &, Options)
Sets the access control policy on the specified resource.
Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::SetIamPolicyRequest 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::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &, Options)
Gets the access control policy for a resource.
Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::GetIamPolicyRequest 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::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &, Options)
Returns permissions that a caller has on the specified resource.
If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::TestIamPermissionsRequest 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::iam::v1::TestIamPermissionsResponse > |
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListOperations(std::string const &, std::string const &, Options)
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation's parent resource. |
filter |
std::string const &
The standard list filter. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListOperations(google::longrunning::ListOperationsRequest, Options)
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::ListOperationsRequest
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::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
GetOperation(std::string const &, Options)
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation resource. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetOperation(google::longrunning::GetOperationRequest const &, Options)
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::GetOperationRequest 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::longrunning::Operation > |
the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |