Google Cloud (GCP) Classic

v6.38.0 published on Thursday, Sep 22, 2022 by Pulumi

getFunction

Get information about a Google Cloud Function. For more information see the official documentation and API.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var my_function = Gcp.CloudFunctions.GetFunction.Invoke(new()
    {
        Name = "function",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/cloudfunctions"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfunctions.LookupFunction(ctx, &cloudfunctions.LookupFunctionArgs{
			Name: "function",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.cloudfunctions.CloudfunctionsFunctions;
import com.pulumi.gcp.cloudfunctions.inputs.GetFunctionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var my-function = CloudfunctionsFunctions.getFunction(GetFunctionArgs.builder()
            .name("function")
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

my_function = gcp.cloudfunctions.get_function(name="function")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const my_function = pulumi.output(gcp.cloudfunctions.getFunction({
    name: "function",
}));
variables:
  my-function:
    Fn::Invoke:
      Function: gcp:cloudfunctions:getFunction
      Arguments:
        name: function

Using getFunction

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getFunction(args: GetFunctionArgs, opts?: InvokeOptions): Promise<GetFunctionResult>
function getFunctionOutput(args: GetFunctionOutputArgs, opts?: InvokeOptions): Output<GetFunctionResult>
def get_function(name: Optional[str] = None,
                 project: Optional[str] = None,
                 region: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFunctionResult
def get_function_output(name: Optional[pulumi.Input[str]] = None,
                 project: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFunctionResult]
func LookupFunction(ctx *Context, args *LookupFunctionArgs, opts ...InvokeOption) (*LookupFunctionResult, error)
func LookupFunctionOutput(ctx *Context, args *LookupFunctionOutputArgs, opts ...InvokeOption) LookupFunctionResultOutput

> Note: This function is named LookupFunction in the Go SDK.

public static class GetFunction 
{
    public static Task<GetFunctionResult> InvokeAsync(GetFunctionArgs args, InvokeOptions? opts = null)
    public static Output<GetFunctionResult> Invoke(GetFunctionInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:cloudfunctions/getFunction:getFunction
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of a Cloud Function.

Project string

The project in which the resource belongs. If it is not provided, the provider project is used.

Region string

The region in which the resource belongs. If it is not provided, the provider region is used.

Name string

The name of a Cloud Function.

Project string

The project in which the resource belongs. If it is not provided, the provider project is used.

Region string

The region in which the resource belongs. If it is not provided, the provider region is used.

name String

The name of a Cloud Function.

project String

The project in which the resource belongs. If it is not provided, the provider project is used.

region String

The region in which the resource belongs. If it is not provided, the provider region is used.

name string

The name of a Cloud Function.

project string

The project in which the resource belongs. If it is not provided, the provider project is used.

region string

The region in which the resource belongs. If it is not provided, the provider region is used.

name str

The name of a Cloud Function.

project str

The project in which the resource belongs. If it is not provided, the provider project is used.

region str

The region in which the resource belongs. If it is not provided, the provider region is used.

name String

The name of a Cloud Function.

project String

The project in which the resource belongs. If it is not provided, the provider project is used.

region String

The region in which the resource belongs. If it is not provided, the provider region is used.

getFunction Result

The following output properties are available:

AvailableMemoryMb int

Available memory (in MB) to the function.

BuildEnvironmentVariables Dictionary<string, object>
Description string

Description of the function.

DockerRegistry string
DockerRepository string
EntryPoint string

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

EnvironmentVariables Dictionary<string, object>
EventTriggers List<GetFunctionEventTrigger>

A source that fires events in response to a condition in another service. Structure is documented below.

HttpsTriggerSecurityLevel string
HttpsTriggerUrl string

If function is triggered by HTTP, trigger URL is set here.

Id string

The provider-assigned unique ID for this managed resource.

IngressSettings string

Controls what traffic can reach the function.

KmsKeyName string
Labels Dictionary<string, object>

A map of labels applied to this function.

MaxInstances int

The limit on the maximum number of function instances that may coexist at a given time.

MinInstances int
Name string

The name of the Cloud Function.

Runtime string

The runtime in which the function is running.

SecretEnvironmentVariables List<GetFunctionSecretEnvironmentVariable>
SecretVolumes List<GetFunctionSecretVolume>
ServiceAccountEmail string

The service account email to be assumed by the cloud function.

SourceArchiveBucket string

The GCS bucket containing the zip archive which contains the function.

SourceArchiveObject string

The source archive object (file) in archive bucket.

SourceRepositories List<GetFunctionSourceRepository>

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

Timeout int

Function execution timeout (in seconds).

TriggerHttp bool

If function is triggered by HTTP, this boolean is set.

VpcConnector string

The VPC Network Connector that this cloud function can connect to.

VpcConnectorEgressSettings string

The egress settings for the connector, controlling what traffic is diverted through it.

Project string
Region string
AvailableMemoryMb int

Available memory (in MB) to the function.

BuildEnvironmentVariables map[string]interface{}
Description string

Description of the function.

DockerRegistry string
DockerRepository string
EntryPoint string

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

EnvironmentVariables map[string]interface{}
EventTriggers []GetFunctionEventTrigger

A source that fires events in response to a condition in another service. Structure is documented below.

HttpsTriggerSecurityLevel string
HttpsTriggerUrl string

If function is triggered by HTTP, trigger URL is set here.

Id string

The provider-assigned unique ID for this managed resource.

IngressSettings string

Controls what traffic can reach the function.

KmsKeyName string
Labels map[string]interface{}

A map of labels applied to this function.

MaxInstances int

The limit on the maximum number of function instances that may coexist at a given time.

MinInstances int
Name string

The name of the Cloud Function.

Runtime string

The runtime in which the function is running.

SecretEnvironmentVariables []GetFunctionSecretEnvironmentVariable
SecretVolumes []GetFunctionSecretVolume
ServiceAccountEmail string

The service account email to be assumed by the cloud function.

SourceArchiveBucket string

The GCS bucket containing the zip archive which contains the function.

SourceArchiveObject string

The source archive object (file) in archive bucket.

SourceRepositories []GetFunctionSourceRepository

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

Timeout int

Function execution timeout (in seconds).

TriggerHttp bool

If function is triggered by HTTP, this boolean is set.

VpcConnector string

The VPC Network Connector that this cloud function can connect to.

VpcConnectorEgressSettings string

The egress settings for the connector, controlling what traffic is diverted through it.

Project string
Region string
availableMemoryMb Integer

Available memory (in MB) to the function.

buildEnvironmentVariables Map<String,Object>
description String

Description of the function.

dockerRegistry String
dockerRepository String
entryPoint String

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

environmentVariables Map<String,Object>
eventTriggers List<GetFunctionEventTrigger>

A source that fires events in response to a condition in another service. Structure is documented below.

httpsTriggerSecurityLevel String
httpsTriggerUrl String

If function is triggered by HTTP, trigger URL is set here.

id String

The provider-assigned unique ID for this managed resource.

ingressSettings String

Controls what traffic can reach the function.

kmsKeyName String
labels Map<String,Object>

A map of labels applied to this function.

maxInstances Integer

The limit on the maximum number of function instances that may coexist at a given time.

minInstances Integer
name String

The name of the Cloud Function.

runtime String

The runtime in which the function is running.

secretEnvironmentVariables List<GetFunctionSecretEnvironmentVariable>
secretVolumes List<GetFunctionSecretVolume>
serviceAccountEmail String

The service account email to be assumed by the cloud function.

sourceArchiveBucket String

The GCS bucket containing the zip archive which contains the function.

sourceArchiveObject String

The source archive object (file) in archive bucket.

sourceRepositories List<GetFunctionSourceRepository>

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

timeout Integer

Function execution timeout (in seconds).

triggerHttp Boolean

If function is triggered by HTTP, this boolean is set.

vpcConnector String

The VPC Network Connector that this cloud function can connect to.

vpcConnectorEgressSettings String

The egress settings for the connector, controlling what traffic is diverted through it.

project String
region String
availableMemoryMb number

Available memory (in MB) to the function.

buildEnvironmentVariables {[key: string]: any}
description string

Description of the function.

dockerRegistry string
dockerRepository string
entryPoint string

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

environmentVariables {[key: string]: any}
eventTriggers GetFunctionEventTrigger[]

A source that fires events in response to a condition in another service. Structure is documented below.

httpsTriggerSecurityLevel string
httpsTriggerUrl string

If function is triggered by HTTP, trigger URL is set here.

id string

The provider-assigned unique ID for this managed resource.

ingressSettings string

Controls what traffic can reach the function.

kmsKeyName string
labels {[key: string]: any}

A map of labels applied to this function.

maxInstances number

The limit on the maximum number of function instances that may coexist at a given time.

minInstances number
name string

The name of the Cloud Function.

runtime string

The runtime in which the function is running.

secretEnvironmentVariables GetFunctionSecretEnvironmentVariable[]
secretVolumes GetFunctionSecretVolume[]
serviceAccountEmail string

The service account email to be assumed by the cloud function.

sourceArchiveBucket string

The GCS bucket containing the zip archive which contains the function.

sourceArchiveObject string

The source archive object (file) in archive bucket.

sourceRepositories GetFunctionSourceRepository[]

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

timeout number

Function execution timeout (in seconds).

triggerHttp boolean

If function is triggered by HTTP, this boolean is set.

vpcConnector string

The VPC Network Connector that this cloud function can connect to.

vpcConnectorEgressSettings string

The egress settings for the connector, controlling what traffic is diverted through it.

project string
region string
available_memory_mb int

Available memory (in MB) to the function.

build_environment_variables Mapping[str, Any]
description str

Description of the function.

docker_registry str
docker_repository str
entry_point str

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

environment_variables Mapping[str, Any]
event_triggers Sequence[GetFunctionEventTrigger]

A source that fires events in response to a condition in another service. Structure is documented below.

https_trigger_security_level str
https_trigger_url str

If function is triggered by HTTP, trigger URL is set here.

id str

The provider-assigned unique ID for this managed resource.

ingress_settings str

Controls what traffic can reach the function.

kms_key_name str
labels Mapping[str, Any]

A map of labels applied to this function.

max_instances int

The limit on the maximum number of function instances that may coexist at a given time.

min_instances int
name str

The name of the Cloud Function.

runtime str

The runtime in which the function is running.

secret_environment_variables Sequence[GetFunctionSecretEnvironmentVariable]
secret_volumes Sequence[GetFunctionSecretVolume]
service_account_email str

The service account email to be assumed by the cloud function.

source_archive_bucket str

The GCS bucket containing the zip archive which contains the function.

source_archive_object str

The source archive object (file) in archive bucket.

source_repositories Sequence[GetFunctionSourceRepository]

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

timeout int

Function execution timeout (in seconds).

trigger_http bool

If function is triggered by HTTP, this boolean is set.

vpc_connector str

The VPC Network Connector that this cloud function can connect to.

vpc_connector_egress_settings str

The egress settings for the connector, controlling what traffic is diverted through it.

project str
region str
availableMemoryMb Number

Available memory (in MB) to the function.

buildEnvironmentVariables Map<Any>
description String

Description of the function.

dockerRegistry String
dockerRepository String
entryPoint String

Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.

environmentVariables Map<Any>
eventTriggers List<Property Map>

A source that fires events in response to a condition in another service. Structure is documented below.

httpsTriggerSecurityLevel String
httpsTriggerUrl String

If function is triggered by HTTP, trigger URL is set here.

id String

The provider-assigned unique ID for this managed resource.

ingressSettings String

Controls what traffic can reach the function.

kmsKeyName String
labels Map<Any>

A map of labels applied to this function.

maxInstances Number

The limit on the maximum number of function instances that may coexist at a given time.

minInstances Number
name String

The name of the Cloud Function.

runtime String

The runtime in which the function is running.

secretEnvironmentVariables List<Property Map>
secretVolumes List<Property Map>
serviceAccountEmail String

The service account email to be assumed by the cloud function.

sourceArchiveBucket String

The GCS bucket containing the zip archive which contains the function.

sourceArchiveObject String

The source archive object (file) in archive bucket.

sourceRepositories List<Property Map>

The URL of the Cloud Source Repository that the function is deployed from. Structure is documented below.

timeout Number

Function execution timeout (in seconds).

triggerHttp Boolean

If function is triggered by HTTP, this boolean is set.

vpcConnector String

The VPC Network Connector that this cloud function can connect to.

vpcConnectorEgressSettings String

The egress settings for the connector, controlling what traffic is diverted through it.

project String
region String

Supporting Types

GetFunctionEventTrigger

EventType string

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

FailurePolicies List<GetFunctionEventTriggerFailurePolicy>

Policy for failed executions. Structure is documented below.

Resource string

The name of the resource whose events are being observed, for example, "myBucket"

EventType string

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

FailurePolicies []GetFunctionEventTriggerFailurePolicy

Policy for failed executions. Structure is documented below.

Resource string

The name of the resource whose events are being observed, for example, "myBucket"

eventType String

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

failurePolicies List<GetFunctionEventTriggerFailurePolicy>

Policy for failed executions. Structure is documented below.

resource String

The name of the resource whose events are being observed, for example, "myBucket"

eventType string

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

failurePolicies GetFunctionEventTriggerFailurePolicy[]

Policy for failed executions. Structure is documented below.

resource string

The name of the resource whose events are being observed, for example, "myBucket"

event_type str

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

failure_policies Sequence[GetFunctionEventTriggerFailurePolicy]

Policy for failed executions. Structure is documented below.

resource str

The name of the resource whose events are being observed, for example, "myBucket"

eventType String

The type of event to observe. For example: "google.storage.object.finalize". See the documentation on calling Cloud Functions for a full reference of accepted triggers.

failurePolicies List<Property Map>

Policy for failed executions. Structure is documented below.

resource String

The name of the resource whose events are being observed, for example, "myBucket"

GetFunctionEventTriggerFailurePolicy

Retry bool

Whether the function should be retried on failure.

Retry bool

Whether the function should be retried on failure.

retry Boolean

Whether the function should be retried on failure.

retry boolean

Whether the function should be retried on failure.

retry bool

Whether the function should be retried on failure.

retry Boolean

Whether the function should be retried on failure.

GetFunctionSecretEnvironmentVariable

Key string
ProjectId string
Secret string
Version string
Key string
ProjectId string
Secret string
Version string
key String
projectId String
secret String
version String
key string
projectId string
secret string
version string
key String
projectId String
secret String
version String

GetFunctionSecretVolume

GetFunctionSecretVolumeVersion

Path string
Version string
Path string
Version string
path String
version String
path string
version string
path str
version str
path String
version String

GetFunctionSourceRepository

DeployedUrl string
Url string

The URL pointing to the hosted repository where the function is defined.

DeployedUrl string
Url string

The URL pointing to the hosted repository where the function is defined.

deployedUrl String
url String

The URL pointing to the hosted repository where the function is defined.

deployedUrl string
url string

The URL pointing to the hosted repository where the function is defined.

deployed_url str
url str

The URL pointing to the hosted repository where the function is defined.

deployedUrl String
url String

The URL pointing to the hosted repository where the function is defined.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.