Cloud Functions v2 API - Class FunctionServiceClient (1.5.0)

public abstract class FunctionServiceClient

Reference documentation and code samples for the Cloud Functions v2 API class FunctionServiceClient.

FunctionService client wrapper, for convenient use.

Inheritance

object > FunctionServiceClient

Namespace

Google.Cloud.Functions.V2

Assembly

Google.Cloud.Functions.V2.dll

Remarks

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.

Properties

CreateFunctionOperationsClient

public virtual OperationsClient CreateFunctionOperationsClient { get; }

The long-running operations client for CreateFunction.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the FunctionService service, which is a host of "cloudfunctions.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default FunctionService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default FunctionService scopes are:

DeleteFunctionOperationsClient

public virtual OperationsClient DeleteFunctionOperationsClient { get; }

The long-running operations client for DeleteFunction.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual FunctionService.FunctionServiceClient GrpcClient { get; }

The underlying gRPC FunctionService client

Property Value
Type Description
FunctionServiceFunctionServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

UpdateFunctionOperationsClient

public virtual OperationsClient UpdateFunctionOperationsClient { get; }

The long-running operations client for UpdateFunction.

Property Value
Type Description
OperationsClient

Methods

Create()

public static FunctionServiceClient Create()

Synchronously creates a FunctionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FunctionServiceClientBuilder.

Returns
Type Description
FunctionServiceClient

The created FunctionServiceClient.

CreateAsync(CancellationToken)

public static Task<FunctionServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a FunctionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FunctionServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskFunctionServiceClient

The task representing the created FunctionServiceClient.

CreateFunction(LocationName, Function, string, CallSettings)

public virtual Operation<Function, OperationMetadata> CreateFunction(LocationName parent, Function function, string functionId, CallSettings callSettings = null)

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 LocationName

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

function Function

Required. Function to be created.

functionId string

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]-/.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = functionServiceClient.CreateFunction(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceCreateFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunction(CreateFunctionRequest, CallSettings)

public virtual Operation<Function, OperationMetadata> CreateFunction(CreateFunctionRequest request, CallSettings callSettings = null)

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 CreateFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
CreateFunctionRequest request = new CreateFunctionRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Function = new Function(),
    FunctionId = "",
};
// Make the request
Operation<Function, OperationMetadata> response = functionServiceClient.CreateFunction(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceCreateFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunction(string, Function, string, CallSettings)

public virtual Operation<Function, OperationMetadata> CreateFunction(string parent, Function function, string functionId, CallSettings callSettings = null)

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 string

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

function Function

Required. Function to be created.

functionId string

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]-/.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = functionServiceClient.CreateFunction(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceCreateFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(LocationName, Function, string, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(LocationName parent, Function function, string functionId, CallSettings callSettings = null)

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 LocationName

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

function Function

Required. Function to be created.

functionId string

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]-/.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(LocationName, Function, string, CancellationToken)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(LocationName parent, Function function, string functionId, CancellationToken cancellationToken)

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 LocationName

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

function Function

Required. Function to be created.

functionId string

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]-/.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(CreateFunctionRequest, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(CreateFunctionRequest request, CallSettings callSettings = null)

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 CreateFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
CreateFunctionRequest request = new CreateFunctionRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Function = new Function(),
    FunctionId = "",
};
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(CreateFunctionRequest, CancellationToken)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(CreateFunctionRequest request, CancellationToken cancellationToken)

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 CreateFunctionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
CreateFunctionRequest request = new CreateFunctionRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Function = new Function(),
    FunctionId = "",
};
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(string, Function, string, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(string parent, Function function, string functionId, CallSettings callSettings = null)

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 string

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

function Function

Required. Function to be created.

functionId string

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]-/.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

CreateFunctionAsync(string, Function, string, CancellationToken)

public virtual Task<Operation<Function, OperationMetadata>> CreateFunctionAsync(string parent, Function function, string functionId, CancellationToken cancellationToken)

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 string

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

function Function

Required. Function to be created.

functionId string

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]-/.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Function function = new Function();
string functionId = "";
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.CreateFunctionAsync(parent, function, functionId);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceCreateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

DeleteFunction(DeleteFunctionRequest, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteFunction(DeleteFunctionRequest request, CallSettings callSettings = null)

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 DeleteFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
DeleteFunctionRequest request = new DeleteFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Operation<Empty, OperationMetadata> response = functionServiceClient.DeleteFunction(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceDeleteFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunction(FunctionName, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteFunction(FunctionName name, CallSettings callSettings = null)

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 FunctionName

Required. The name of the function which should be deleted.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Operation<Empty, OperationMetadata> response = functionServiceClient.DeleteFunction(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceDeleteFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunction(string, CallSettings)

public virtual Operation<Empty, OperationMetadata> DeleteFunction(string name, CallSettings callSettings = null)

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 string

Required. The name of the function which should be deleted.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Operation<Empty, OperationMetadata> response = functionServiceClient.DeleteFunction(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceDeleteFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(DeleteFunctionRequest, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(DeleteFunctionRequest request, CallSettings callSettings = null)

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 DeleteFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteFunctionRequest request = new DeleteFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(DeleteFunctionRequest, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(DeleteFunctionRequest request, CancellationToken cancellationToken)

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 DeleteFunctionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteFunctionRequest request = new DeleteFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(FunctionName, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(FunctionName name, CallSettings callSettings = null)

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 FunctionName

Required. The name of the function which should be deleted.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(FunctionName, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(FunctionName name, CancellationToken cancellationToken)

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 FunctionName

Required. The name of the function which should be deleted.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(string, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(string name, CallSettings callSettings = null)

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 string

Required. The name of the function which should be deleted.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteFunctionAsync(string, CancellationToken)

public virtual Task<Operation<Empty, OperationMetadata>> DeleteFunctionAsync(string name, CancellationToken cancellationToken)

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 string

Required. The name of the function which should be deleted.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Operation<Empty, OperationMetadata> response = await functionServiceClient.DeleteFunctionAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceDeleteFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

GenerateDownloadUrl(GenerateDownloadUrlRequest, CallSettings)

public virtual GenerateDownloadUrlResponse GenerateDownloadUrl(GenerateDownloadUrlRequest request, CallSettings callSettings = null)

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 GenerateDownloadUrlRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerateDownloadUrlResponse

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
GenerateDownloadUrlRequest request = new GenerateDownloadUrlRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
GenerateDownloadUrlResponse response = functionServiceClient.GenerateDownloadUrl(request);

GenerateDownloadUrlAsync(GenerateDownloadUrlRequest, CallSettings)

public virtual Task<GenerateDownloadUrlResponse> GenerateDownloadUrlAsync(GenerateDownloadUrlRequest request, CallSettings callSettings = null)

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 GenerateDownloadUrlRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerateDownloadUrlResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateDownloadUrlRequest request = new GenerateDownloadUrlRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
GenerateDownloadUrlResponse response = await functionServiceClient.GenerateDownloadUrlAsync(request);

GenerateDownloadUrlAsync(GenerateDownloadUrlRequest, CancellationToken)

public virtual Task<GenerateDownloadUrlResponse> GenerateDownloadUrlAsync(GenerateDownloadUrlRequest request, CancellationToken cancellationToken)

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 GenerateDownloadUrlRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerateDownloadUrlResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateDownloadUrlRequest request = new GenerateDownloadUrlRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
GenerateDownloadUrlResponse response = await functionServiceClient.GenerateDownloadUrlAsync(request);

GenerateUploadUrl(GenerateUploadUrlRequest, CallSettings)

public virtual GenerateUploadUrlResponse GenerateUploadUrl(GenerateUploadUrlRequest request, CallSettings callSettings = null)

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
Name Description
request GenerateUploadUrlRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerateUploadUrlResponse

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
GenerateUploadUrlRequest request = new GenerateUploadUrlRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
GenerateUploadUrlResponse response = functionServiceClient.GenerateUploadUrl(request);

GenerateUploadUrlAsync(GenerateUploadUrlRequest, CallSettings)

public virtual Task<GenerateUploadUrlResponse> GenerateUploadUrlAsync(GenerateUploadUrlRequest request, CallSettings callSettings = null)

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
Name Description
request GenerateUploadUrlRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerateUploadUrlResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateUploadUrlRequest request = new GenerateUploadUrlRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
GenerateUploadUrlResponse response = await functionServiceClient.GenerateUploadUrlAsync(request);

GenerateUploadUrlAsync(GenerateUploadUrlRequest, CancellationToken)

public virtual Task<GenerateUploadUrlResponse> GenerateUploadUrlAsync(GenerateUploadUrlRequest request, CancellationToken cancellationToken)

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
Name Description
request GenerateUploadUrlRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerateUploadUrlResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateUploadUrlRequest request = new GenerateUploadUrlRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
GenerateUploadUrlResponse response = await functionServiceClient.GenerateUploadUrlAsync(request);

GetFunction(FunctionName, CallSettings)

public virtual Function GetFunction(FunctionName name, CallSettings callSettings = null)

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

Parameters
Name Description
name FunctionName

Required. The name of the function which details should be obtained.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Function

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Function response = functionServiceClient.GetFunction(name);

GetFunction(GetFunctionRequest, CallSettings)

public virtual Function GetFunction(GetFunctionRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request GetFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Function

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
GetFunctionRequest request = new GetFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Function response = functionServiceClient.GetFunction(request);

GetFunction(string, CallSettings)

public virtual Function GetFunction(string name, CallSettings callSettings = null)

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

Parameters
Name Description
name string

Required. The name of the function which details should be obtained.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Function

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Function response = functionServiceClient.GetFunction(name);

GetFunctionAsync(FunctionName, CallSettings)

public virtual Task<Function> GetFunctionAsync(FunctionName name, CallSettings callSettings = null)

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

Parameters
Name Description
name FunctionName

Required. The name of the function which details should be obtained.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(name);

GetFunctionAsync(FunctionName, CancellationToken)

public virtual Task<Function> GetFunctionAsync(FunctionName name, CancellationToken cancellationToken)

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

Parameters
Name Description
name FunctionName

Required. The name of the function which details should be obtained.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
FunctionName name = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]");
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(name);

GetFunctionAsync(GetFunctionRequest, CallSettings)

public virtual Task<Function> GetFunctionAsync(GetFunctionRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request GetFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GetFunctionRequest request = new GetFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(request);

GetFunctionAsync(GetFunctionRequest, CancellationToken)

public virtual Task<Function> GetFunctionAsync(GetFunctionRequest request, CancellationToken cancellationToken)

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

Parameters
Name Description
request GetFunctionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
GetFunctionRequest request = new GetFunctionRequest
{
    FunctionName = FunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
};
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(request);

GetFunctionAsync(string, CallSettings)

public virtual Task<Function> GetFunctionAsync(string name, CallSettings callSettings = null)

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

Parameters
Name Description
name string

Required. The name of the function which details should be obtained.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(name);

GetFunctionAsync(string, CancellationToken)

public virtual Task<Function> GetFunctionAsync(string name, CancellationToken cancellationToken)

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

Parameters
Name Description
name string

Required. The name of the function which details should be obtained.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskFunction

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/functions/[FUNCTION]";
// Make the request
Function response = await functionServiceClient.GetFunctionAsync(name);

ListFunctions(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListFunctionsResponse, Function> ListFunctions(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent LocationName

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.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListFunctionsResponseFunction

A pageable sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Function item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFunctionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFunctions(ListFunctionsRequest, CallSettings)

public virtual PagedEnumerable<ListFunctionsResponse, Function> ListFunctions(ListFunctionsRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ListFunctionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListFunctionsResponseFunction

A pageable sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
ListFunctionsRequest request = new ListFunctionsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctions(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Function item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFunctionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFunctions(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListFunctionsResponse, Function> ListFunctions(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListFunctionsResponseFunction

A pageable sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Function item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFunctionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFunctionsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListFunctionsResponse, Function> ListFunctionsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent LocationName

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.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListFunctionsResponseFunction

A pageable asynchronous sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Function item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListFunctionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFunctionsAsync(ListFunctionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListFunctionsResponse, Function> ListFunctionsAsync(ListFunctionsRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ListFunctionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListFunctionsResponseFunction

A pageable asynchronous sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
ListFunctionsRequest request = new ListFunctionsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctionsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Function item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListFunctionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFunctionsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListFunctionsResponse, Function> ListFunctionsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListFunctionsResponseFunction

A pageable asynchronous sequence of Function resources.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListFunctionsResponse, Function> response = functionServiceClient.ListFunctionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Function item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListFunctionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Function item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Function> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Function item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListRuntimes(LocationName, CallSettings)

public virtual ListRuntimesResponse ListRuntimes(LocationName parent, CallSettings callSettings = null)

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

Parameters
Name Description
parent LocationName

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListRuntimesResponse

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListRuntimesResponse response = functionServiceClient.ListRuntimes(parent);

ListRuntimes(ListRuntimesRequest, CallSettings)

public virtual ListRuntimesResponse ListRuntimes(ListRuntimesRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ListRuntimesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListRuntimesResponse

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
ListRuntimesRequest request = new ListRuntimesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListRuntimesResponse response = functionServiceClient.ListRuntimes(request);

ListRuntimes(string, CallSettings)

public virtual ListRuntimesResponse ListRuntimes(string parent, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListRuntimesResponse

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListRuntimesResponse response = functionServiceClient.ListRuntimes(parent);

ListRuntimesAsync(LocationName, CallSettings)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(LocationName parent, CallSettings callSettings = null)

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

Parameters
Name Description
parent LocationName

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(parent);

ListRuntimesAsync(LocationName, CancellationToken)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(LocationName parent, CancellationToken cancellationToken)

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

Parameters
Name Description
parent LocationName

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(parent);

ListRuntimesAsync(ListRuntimesRequest, CallSettings)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(ListRuntimesRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ListRuntimesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
ListRuntimesRequest request = new ListRuntimesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(request);

ListRuntimesAsync(ListRuntimesRequest, CancellationToken)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(ListRuntimesRequest request, CancellationToken cancellationToken)

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

Parameters
Name Description
request ListRuntimesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
ListRuntimesRequest request = new ListRuntimesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(request);

ListRuntimesAsync(string, CallSettings)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(string parent, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(parent);

ListRuntimesAsync(string, CancellationToken)

public virtual Task<ListRuntimesResponse> ListRuntimesAsync(string parent, CancellationToken cancellationToken)

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

Parameters
Name Description
parent string

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListRuntimesResponse

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListRuntimesResponse response = await functionServiceClient.ListRuntimesAsync(parent);

PollOnceCreateFunction(string, CallSettings)

public virtual Operation<Function, OperationMetadata> PollOnceCreateFunction(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The result of polling the operation.

PollOnceCreateFunctionAsync(string, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> PollOnceCreateFunctionAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A task representing the result of polling the operation.

PollOnceDeleteFunction(string, CallSettings)

public virtual Operation<Empty, OperationMetadata> PollOnceDeleteFunction(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of DeleteFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyOperationMetadata

The result of polling the operation.

PollOnceDeleteFunctionAsync(string, CallSettings)

public virtual Task<Operation<Empty, OperationMetadata>> PollOnceDeleteFunctionAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of DeleteFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyOperationMetadata

A task representing the result of polling the operation.

PollOnceUpdateFunction(string, CallSettings)

public virtual Operation<Function, OperationMetadata> PollOnceUpdateFunction(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of UpdateFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The result of polling the operation.

PollOnceUpdateFunctionAsync(string, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> PollOnceUpdateFunctionAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of UpdateFunction.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateFunction(Function, FieldMask, CallSettings)

public virtual Operation<Function, OperationMetadata> UpdateFunction(Function function, FieldMask updateMask, CallSettings callSettings = null)

Updates existing function.

Parameters
Name Description
function Function

Required. New version of the function.

updateMask FieldMask

The list of fields to be updated. If no field mask is provided, all provided fields in the request will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
Function function = new Function();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Function, OperationMetadata> response = functionServiceClient.UpdateFunction(function, updateMask);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceUpdateFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

UpdateFunction(UpdateFunctionRequest, CallSettings)

public virtual Operation<Function, OperationMetadata> UpdateFunction(UpdateFunctionRequest request, CallSettings callSettings = null)

Updates existing function.

Parameters
Name Description
request UpdateFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationFunctionOperationMetadata

The RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = FunctionServiceClient.Create();
// Initialize request argument(s)
UpdateFunctionRequest request = new UpdateFunctionRequest
{
    Function = new Function(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Function, OperationMetadata> response = functionServiceClient.UpdateFunction(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = functionServiceClient.PollOnceUpdateFunction(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

UpdateFunctionAsync(Function, FieldMask, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> UpdateFunctionAsync(Function function, FieldMask updateMask, CallSettings callSettings = null)

Updates existing function.

Parameters
Name Description
function Function

Required. New version of the function.

updateMask FieldMask

The list of fields to be updated. If no field mask is provided, all provided fields in the request will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
Function function = new Function();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.UpdateFunctionAsync(function, updateMask);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceUpdateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

UpdateFunctionAsync(Function, FieldMask, CancellationToken)

public virtual Task<Operation<Function, OperationMetadata>> UpdateFunctionAsync(Function function, FieldMask updateMask, CancellationToken cancellationToken)

Updates existing function.

Parameters
Name Description
function Function

Required. New version of the function.

updateMask FieldMask

The list of fields to be updated. If no field mask is provided, all provided fields in the request will be updated.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
Function function = new Function();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.UpdateFunctionAsync(function, updateMask);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceUpdateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

UpdateFunctionAsync(UpdateFunctionRequest, CallSettings)

public virtual Task<Operation<Function, OperationMetadata>> UpdateFunctionAsync(UpdateFunctionRequest request, CallSettings callSettings = null)

Updates existing function.

Parameters
Name Description
request UpdateFunctionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateFunctionRequest request = new UpdateFunctionRequest
{
    Function = new Function(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.UpdateFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceUpdateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}

UpdateFunctionAsync(UpdateFunctionRequest, CancellationToken)

public virtual Task<Operation<Function, OperationMetadata>> UpdateFunctionAsync(UpdateFunctionRequest request, CancellationToken cancellationToken)

Updates existing function.

Parameters
Name Description
request UpdateFunctionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationFunctionOperationMetadata

A Task containing the RPC response.

Example
// Create client
FunctionServiceClient functionServiceClient = await FunctionServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateFunctionRequest request = new UpdateFunctionRequest
{
    Function = new Function(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Function, OperationMetadata> response = await functionServiceClient.UpdateFunctionAsync(request);

// Poll until the returned long-running operation is complete
Operation<Function, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Function result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Function, OperationMetadata> retrievedResponse = await functionServiceClient.PollOnceUpdateFunctionAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Function retrievedResult = retrievedResponse.Result;
}