Class FunctionServiceClient (2.21.0)

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
NameDescription
FunctionServiceClient const &

FunctionServiceClient(FunctionServiceClient &&)

Copy and move support

Parameter
NameDescription
FunctionServiceClient &&

FunctionServiceClient(std::shared_ptr< FunctionServiceConnection >, Options)

Parameters
NameDescription
connection std::shared_ptr< FunctionServiceConnection >
opts Options

Operators

operator=(FunctionServiceClient const &)

Copy and move support

Parameter
NameDescription
FunctionServiceClient const &
Returns
TypeDescription
FunctionServiceClient &

operator=(FunctionServiceClient &&)

Copy and move support

Parameter
NameDescription
FunctionServiceClient &&
Returns
TypeDescription
FunctionServiceClient &

Functions

GetFunction(std::string const &, Options)

Returns a function with the given name from the requested project.

Parameters
NameDescription
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
TypeDescription
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 StatusOr contains the error details.

GetFunction(google::cloud::functions::v2::GetFunctionRequest const &, Options)

Returns a function with the given name from the requested project.

Parameters
NameDescription
request google::cloud::functions::v2::GetFunctionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.GetFunctionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 StatusOr contains the error details.

ListFunctions(std::string const &, Options)

Returns a list of functions that belong to the requested project.

Parameters
NameDescription
parent std::string const &

Required. The project and location from which the function should be listed, specified in the format projects/*/locations/* If you want to list functions in all locations, use "-" in place of a location. When listing functions in all locations, if one or more location(s) are unreachable, the response will contain functions from all reachable locations along with the names of any unreachable locations.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.functions.v2.Function, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListFunctions(google::cloud::functions::v2::ListFunctionsRequest, Options)

Returns a list of functions that belong to the requested project.

Parameters
NameDescription
request google::cloud::functions::v2::ListFunctionsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.ListFunctionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.functions.v2.Function, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

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
NameDescription
parent std::string const &

Required. The project and location in which the function should be created, specified in the format projects/*/locations/*

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.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::functions::v2::Function > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.Function proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

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
NameDescription
request google::cloud::functions::v2::CreateFunctionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.CreateFunctionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::functions::v2::Function > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.Function proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateFunction(google::cloud::functions::v2::Function const &, google::protobuf::FieldMask const &, Options)

Updates existing function.

Parameters
NameDescription
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 provided fields in the request will be updated.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::functions::v2::Function > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.Function proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateFunction(google::cloud::functions::v2::UpdateFunctionRequest const &, Options)

Updates existing function.

Parameters
NameDescription
request google::cloud::functions::v2::UpdateFunctionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.UpdateFunctionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::functions::v2::Function > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.Function proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

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
NameDescription
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
TypeDescription
future< StatusOr< google::cloud::functions::v2::OperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.OperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

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
NameDescription
request google::cloud::functions::v2::DeleteFunctionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.DeleteFunctionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::functions::v2::OperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.functions.v2.OperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

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, these two headers need to be specified:

  • content-type: application/zip

And this header SHOULD NOT be specified:

  • Authorization: Bearer YOUR_TOKEN
Parameters
NameDescription
request google::cloud::functions::v2::GenerateUploadUrlRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.GenerateUploadUrlRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 StatusOr contains the error details.

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
NameDescription
request google::cloud::functions::v2::GenerateDownloadUrlRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.GenerateDownloadUrlRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 StatusOr contains the error details.

ListRuntimes(std::string const &, Options)

Returns a list of runtimes that are supported for the requested project.

Parameters
NameDescription
parent std::string const &

Required. The project and location from which the runtimes should be listed, specified in the format projects/*/locations/*

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 StatusOr contains the error details.

ListRuntimes(google::cloud::functions::v2::ListRuntimesRequest const &, Options)

Returns a list of runtimes that are supported for the requested project.

Parameters
NameDescription
request google::cloud::functions::v2::ListRuntimesRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.functions.v2.ListRuntimesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
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 StatusOr contains the error details.