As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Functions v2 API

class google.cloud.functions_v2.types.AutomaticUpdatePolicy(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Security patches are applied automatically to the runtime without requiring the function to be redeployed.

class google.cloud.functions_v2.types.BuildConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes the Build step of the function that builds a container from the given source.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

automatic_update_policy

This field is a member of oneof runtime_update_policy.

Type

google.cloud.functions_v2.types.AutomaticUpdatePolicy

on_deploy_update_policy

This field is a member of oneof runtime_update_policy.

Type

google.cloud.functions_v2.types.OnDeployUpdatePolicy

build

Output only. The Cloud Build name of the latest successful deployment of the function.

Type

str

runtime

The runtime in which to run the function. Required when deploying a new function, optional when updating an existing function. For a complete list of possible choices, see the `gcloud command reference <https://cloud.google.com/sdk/gcloud/reference/functions/deploy#–runtime>`__.

Type

str

entry_point

The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named “function”. For Node.js this is name of a function exported by the module specified in source_location.

Type

str

source

The location of the function source code.

Type

google.cloud.functions_v2.types.Source

source_provenance

Output only. A permanent fixed identifier for source.

Type

google.cloud.functions_v2.types.SourceProvenance

worker_pool

Name of the Cloud Build Custom Worker Pool that should be used to build the function. The format of this field is projects/{project}/locations/{region}/workerPools/{workerPool} where {project} and {region} are the project id and region respectively where the worker pool is defined and {workerPool} is the short name of the worker pool.

If the project id is not the same as the function, then the Cloud Functions Service Agent (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be granted the role Cloud Build Custom Workers Builder (roles/cloudbuild.customworkers.builder) in the project.

Type

str

environment_variables

User-provided build-time environment variables for the function

Type

MutableMapping[str, str]

docker_registry

Docker Registry to use for this deployment. This configuration is only applicable to 1st Gen functions, 2nd Gen functions can only use Artifact Registry.

If unspecified, it defaults to ARTIFACT_REGISTRY. If docker_repository field is specified, this field should either be left unspecified or set to ARTIFACT_REGISTRY.

Type

google.cloud.functions_v2.types.BuildConfig.DockerRegistry

docker_repository

Repository in Artifact Registry to which the function docker image will be pushed after it is built by Cloud Build. If specified by user, it is created and managed by user with a customer managed encryption key. Otherwise, GCF will create and use a repository named ‘gcf-artifacts’ for every deployed region.

It must match the pattern projects/{project}/locations/{location}/repositories/{repository}.

Cross-project repositories are not supported. Cross-location repositories are not supported. Repository format must be ‘DOCKER’.

Type

str

service_account

Service account to be used for building the container. The format of this field is projects/{projectId}/serviceAccounts/{serviceAccountEmail}.

Type

str

class DockerRegistry(value)[source]

Bases: proto.enums.Enum

Docker Registry to use for storing function Docker images.

Values:
DOCKER_REGISTRY_UNSPECIFIED (0):

Unspecified.

CONTAINER_REGISTRY (1):

Docker images will be stored in multi-regional Container Registry repositories named gcf.

ARTIFACT_REGISTRY (2):

Docker images will be stored in regional Artifact Registry repositories. By default, GCF will create and use repositories named gcf-artifacts in every region in which a function is deployed. But the repository to use can also be specified by the user using the docker_repository field.

class EnvironmentVariablesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.functions_v2.types.CreateFunctionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the CreateFunction method.

parent

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

Type

str

function

Required. Function to be created.

Type

google.cloud.functions_v2.types.Function

function_id

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

Type

str

class google.cloud.functions_v2.types.DeleteFunctionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the DeleteFunction method.

name

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

Type

str

class google.cloud.functions_v2.types.Environment(value)[source]

Bases: proto.enums.Enum

The environment the function is hosted on.

Values:
ENVIRONMENT_UNSPECIFIED (0):

Unspecified

GEN_1 (1):

Gen 1

GEN_2 (2):

Gen 2

class google.cloud.functions_v2.types.EventFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Filters events based on exact matches on the CloudEvents attributes.

attribute

Required. The name of a CloudEvents attribute.

Type

str

value

Required. The value for the attribute.

Type

str

operator

Optional. The operator used for matching the events with the value of the filter. If not specified, only events that have an exact key-value pair specified in the filter are matched. The only allowed value is match-path-pattern.

Type

str

class google.cloud.functions_v2.types.EventTrigger(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes EventTrigger, used to request events to be sent from another service.

trigger

Output only. The resource name of the Eventarc trigger. The format of this field is projects/{project}/locations/{region}/triggers/{trigger}.

Type

str

trigger_region

The region that the trigger will be in. The trigger will only receive events originating in this region. It can be the same region as the function, a different region or multi-region, or the global region. If not provided, defaults to the same region as the function.

Type

str

event_type

Required. The type of event to observe. For example: google.cloud.audit.log.v1.written or google.cloud.pubsub.topic.v1.messagePublished.

Type

str

event_filters

Criteria used to filter events.

Type

MutableSequence[google.cloud.functions_v2.types.EventFilter]

pubsub_topic

Optional. The name of a Pub/Sub topic in the same project that will be used as the transport topic for the event delivery. Format: projects/{project}/topics/{topic}.

This is only valid for events of type google.cloud.pubsub.topic.v1.messagePublished. The topic provided here will not be deleted at function deletion.

Type

str

service_account_email

Optional. The email of the trigger’s service account. The service account must have permission to invoke Cloud Run services, the permission is run.routes.invoke. If empty, defaults to the Compute Engine default service account: {project_number}-compute@developer.gserviceaccount.com.

Type

str

retry_policy

Optional. If unset, then defaults to ignoring failures (i.e. not retrying them).

Type

google.cloud.functions_v2.types.EventTrigger.RetryPolicy

channel

Optional. The name of the channel associated with the trigger in projects/{project}/locations/{location}/channels/{channel} format. You must provide a channel to receive events from Eventarc SaaS partners.

Type

str

service

Optional. The hostname of the service that 1st Gen function should be observed.

If no string is provided, the default service implementing the API will be used. For example, storage.googleapis.com is the default for all event types in the google.storage namespace.

The field is only applicable to 1st Gen functions.

Type

str

class RetryPolicy(value)[source]

Bases: proto.enums.Enum

Describes the retry policy in case of function’s execution failure. Retried execution is charged as any other execution.

Values:
RETRY_POLICY_UNSPECIFIED (0):

Not specified.

RETRY_POLICY_DO_NOT_RETRY (1):

Do not retry.

RETRY_POLICY_RETRY (2):

Retry on any failure, retry up to 7 days with an exponential backoff (capped at 10 seconds).

class google.cloud.functions_v2.types.Function(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes a Cloud Function that contains user computation executed in response to an event. It encapsulates function and trigger configurations.

name

A user-defined name of the function. Function names must be unique globally and match pattern projects/*/locations/*/functions/*

Type

str

description

User-provided description of a function.

Type

str

build_config

Describes the Build step of the function that builds a container from the given source.

Type

google.cloud.functions_v2.types.BuildConfig

service_config

Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).

Type

google.cloud.functions_v2.types.ServiceConfig

event_trigger

An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.

Type

google.cloud.functions_v2.types.EventTrigger

state

Output only. State of the function.

Type

google.cloud.functions_v2.types.Function.State

update_time

Output only. The last update timestamp of a Cloud Function.

Type

google.protobuf.timestamp_pb2.Timestamp

labels

Labels associated with this Cloud Function.

Type

MutableMapping[str, str]

state_messages

Output only. State Messages for this Cloud Function.

Type

MutableSequence[google.cloud.functions_v2.types.StateMessage]

environment

Describe whether the function is 1st Gen or 2nd Gen.

Type

google.cloud.functions_v2.types.Environment

url

Output only. The deployed url for the function.

Type

str

kms_key_name

[Preview] Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources.

It must match the pattern projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}.

Type

str

satisfies_pzs

Output only. Reserved for future use.

Type

bool

create_time

Output only. The create timestamp of a Cloud Function. This is only applicable to 2nd Gen functions.

Type

google.protobuf.timestamp_pb2.Timestamp

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class State(value)[source]

Bases: proto.enums.Enum

Describes the current state of the function.

Values:
STATE_UNSPECIFIED (0):

Not specified. Invalid state.

ACTIVE (1):

Function has been successfully deployed and is serving.

FAILED (2):

Function deployment failed and the function is not serving.

DEPLOYING (3):

Function is being created or updated.

DELETING (4):

Function is being deleted.

UNKNOWN (5):

Function deployment failed and the function serving state is undefined. The function should be updated or deleted to move it out of this state.

class google.cloud.functions_v2.types.GenerateDownloadUrlRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request of GenerateDownloadUrl method.

name

Required. The name of function for which source code Google Cloud Storage signed URL should be generated.

Type

str

class google.cloud.functions_v2.types.GenerateDownloadUrlResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response of GenerateDownloadUrl method.

download_url

The generated Google Cloud Storage signed URL that should be used for function source code download.

Type

str

class google.cloud.functions_v2.types.GenerateUploadUrlRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request of GenerateSourceUploadUrl method.

parent

Required. The project and location in which the Google Cloud Storage signed URL should be generated, specified in the format projects/*/locations/*.

Type

str

kms_key_name

[Preview] Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function source code objects in intermediate Cloud Storage buckets. When you generate an upload url and upload your source code, it gets copied to an intermediate Cloud Storage bucket. The source code is then copied to a versioned directory in the sources bucket in the consumer project during the function deployment.

It must match the pattern projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}.

The Google Cloud Functions service account (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be granted the role ‘Cloud KMS CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)’ on the Key/KeyRing/Project/Organization (least access preferred).

Type

str

environment

The function environment the generated upload url will be used for. The upload url for 2nd Gen functions can also be used for 1st gen functions, but not vice versa. If not specified, 2nd generation-style upload URLs are generated.

Type

google.cloud.functions_v2.types.Environment

class google.cloud.functions_v2.types.GenerateUploadUrlResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response of GenerateSourceUploadUrl method.

upload_url

The generated Google Cloud Storage signed URL that should be used for a function source code upload. The uploaded file should be a zip archive which contains a function.

Type

str

storage_source

The location of the source code in the upload bucket.

Once the archive is uploaded using the upload_url use this field to set the function.build_config.source.storage_source during CreateFunction and UpdateFunction.

Generation defaults to 0, as Cloud Storage provides a new generation only upon uploading a new object or version of an object.

Type

google.cloud.functions_v2.types.StorageSource

class google.cloud.functions_v2.types.GetFunctionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the GetFunction method.

name

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

Type

str

revision

Optional. The version of the 1st gen function whose details should be obtained. The version of a 1st gen function is an integer that starts from 1 and gets incremented on redeployments. GCF may keep historical configs for old versions of 1st gen function. This field can be specified to fetch the historical configs. This field is valid only for GCF 1st gen function.

Type

str

class google.cloud.functions_v2.types.ListFunctionsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the ListFunctions method.

parent

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.

Type

str

page_size

Maximum number of functions to return per call. The largest allowed page_size is 1,000, if the page_size is omitted or specified as greater than 1,000 then it will be replaced as 1,000. The size of the list response can be less than specified when used with filters.

Type

int

page_token

The value returned by the last ListFunctionsResponse; indicates that this is a continuation of a prior ListFunctions call, and that the system should return the next page of data.

Type

str

filter

The filter for Functions that match the filter expression, following the syntax outlined in https://google.aip.dev/160.

Type

str

order_by

The sorting order of the resources returned. Value should be a comma separated list of fields. The default sorting oder is ascending. See https://google.aip.dev/132#ordering.

Type

str

class google.cloud.functions_v2.types.ListFunctionsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for the ListFunctions method.

functions

The functions that match the request.

Type

MutableSequence[google.cloud.functions_v2.types.Function]

next_page_token

A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

Type

str

unreachable

Locations that could not be reached. The response does not include any functions from these locations.

Type

MutableSequence[str]

class google.cloud.functions_v2.types.ListRuntimesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the ListRuntimes method.

parent

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

Type

str

filter

The filter for Runtimes that match the filter expression, following the syntax outlined in https://google.aip.dev/160.

Type

str

class google.cloud.functions_v2.types.ListRuntimesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response for the ListRuntimes method.

runtimes

The runtimes that match the request.

Type

MutableSequence[google.cloud.functions_v2.types.ListRuntimesResponse.Runtime]

class Runtime(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes a runtime and any special information (e.g., deprecation status) related to it.

name

The name of the runtime, e.g., ‘go113’, ‘nodejs12’, etc.

Type

str

display_name

The user facing name, eg ‘Go 1.13’, ‘Node.js 12’, etc.

Type

str

stage

The stage of life this runtime is in, e.g., BETA, GA, etc.

Type

google.cloud.functions_v2.types.ListRuntimesResponse.RuntimeStage

warnings

Warning messages, e.g., a deprecation warning.

Type

MutableSequence[str]

environment

The environment for the runtime.

Type

google.cloud.functions_v2.types.Environment

deprecation_date

Deprecation date for the runtime.

Type

google.type.date_pb2.Date

decommission_date

Decommission date for the runtime.

Type

google.type.date_pb2.Date

class RuntimeStage(value)[source]

Bases: proto.enums.Enum

The various stages that a runtime can be in.

Values:
RUNTIME_STAGE_UNSPECIFIED (0):

Not specified.

DEVELOPMENT (1):

The runtime is in development.

ALPHA (2):

The runtime is in the Alpha stage.

BETA (3):

The runtime is in the Beta stage.

GA (4):

The runtime is generally available.

DEPRECATED (5):

The runtime is deprecated.

DECOMMISSIONED (6):

The runtime is no longer supported.

class google.cloud.functions_v2.types.LocationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Extra GCF specific location information.

environments

The Cloud Function environments this location supports.

Type

MutableSequence[google.cloud.functions_v2.types.Environment]

class google.cloud.functions_v2.types.OnDeployUpdatePolicy(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Security patches are only applied when a function is redeployed.

runtime_version

Output only. contains the runtime version which was used during latest function deployment.

Type

str

class google.cloud.functions_v2.types.OperationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Represents the metadata of the long-running operation.

create_time

The time the operation was created.

Type

google.protobuf.timestamp_pb2.Timestamp

end_time

The time the operation finished running.

Type

google.protobuf.timestamp_pb2.Timestamp

target

Server-defined resource path for the target of the operation.

Type

str

verb

Name of the verb executed by the operation.

Type

str

status_detail

Human-readable status of the operation, if any.

Type

str

cancel_requested

Identifies whether the user has requested cancellation of the operation. Operations that have successfully been cancelled have [google.longrunning.Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED.

Type

bool

api_version

API version used to start the operation.

Type

str

request_resource

The original request that started the operation.

Type

google.protobuf.any_pb2.Any

stages

Mechanism for reporting in-progress stages

Type

MutableSequence[google.cloud.functions_v2.types.Stage]

source_token

An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.

Type

str

build_name

The build name of the function for create and update operations.

Type

str

operation_type

The operation type.

Type

google.cloud.functions_v2.types.OperationType

class google.cloud.functions_v2.types.OperationType(value)[source]

Bases: proto.enums.Enum

The type of the long running operation.

Values:
OPERATIONTYPE_UNSPECIFIED (0):

Unspecified

CREATE_FUNCTION (1):

CreateFunction

UPDATE_FUNCTION (2):

UpdateFunction

DELETE_FUNCTION (3):

DeleteFunction

class google.cloud.functions_v2.types.RepoSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Location of the source in a Google Cloud Source Repository.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

branch_name

Regex matching branches to build.

The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax

This field is a member of oneof revision.

Type

str

tag_name

Regex matching tags to build.

The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax

This field is a member of oneof revision.

Type

str

commit_sha

Explicit commit SHA to build.

This field is a member of oneof revision.

Type

str

project_id

ID of the project that owns the Cloud Source Repository. If omitted, the project ID requesting the build is assumed.

Type

str

repo_name

Name of the Cloud Source Repository.

Type

str

dir_

Directory, relative to the source root, in which to run the build.

This must be a relative path. If a step’s dir is specified and is an absolute path, this value is ignored for that step’s execution. eg. helloworld (no leading slash allowed)

Type

str

invert_regex

Only trigger a build if the revision regex does NOT match the revision regex.

Type

bool

class google.cloud.functions_v2.types.SecretEnvVar(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable.

key

Name of the environment variable.

Type

str

project_id

Project identifier (preferably project number but can also be the project ID) of the project that contains the secret. If not set, it is assumed that the secret is in the same project as the function.

Type

str

secret

Name of the secret in secret manager (not the full resource name).

Type

str

version

Version of the secret (version number or the string ‘latest’). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new instances start.

Type

str

class google.cloud.functions_v2.types.SecretVolume(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container.

mount_path

The path within the container to mount the secret volume. For example, setting the mount_path as /etc/secrets would mount the secret value files under the /etc/secrets directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount path: /etc/secrets

Type

str

project_id

Project identifier (preferably project number but can also be the project ID) of the project that contains the secret. If not set, it is assumed that the secret is in the same project as the function.

Type

str

secret

Name of the secret in secret manager (not the full resource name).

Type

str

versions

List of secret versions to mount for this secret. If empty, the latest version of the secret will be made available in a file named after the secret under the mount point.

Type

MutableSequence[google.cloud.functions_v2.types.SecretVolume.SecretVersion]

class SecretVersion(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Configuration for a single version.

version

Version of the secret (version number or the string ‘latest’). It is preferable to use latest version with secret volumes as secret value changes are reflected immediately.

Type

str

path

Relative path of the file under the mount path where the secret value for this version will be fetched and made available. For example, setting the mount_path as ‘/etc/secrets’ and path as secret_foo would mount the secret value file at /etc/secrets/secret_foo.

Type

str

class google.cloud.functions_v2.types.ServiceConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes the Service being deployed. Currently Supported : Cloud Run (fully managed).

service

Output only. Name of the service associated with a Function. The format of this field is projects/{project}/locations/{region}/services/{service}

Type

str

timeout_seconds

The function execution timeout. Execution is considered failed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds.

Type

int

available_memory

The amount of memory available for a function. Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is supplied the value is interpreted as bytes. See https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go a full description.

Type

str

available_cpu

The number of CPUs used in a single container instance. Default value is calculated from available memory. Supports the same values as Cloud Run, see https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements Example: “1” indicates 1 vCPU

Type

str

environment_variables

Environment variables that shall be available during function execution.

Type

MutableMapping[str, str]

max_instance_count

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

In some cases, such as rapid traffic surges, Cloud Functions may, for a short period of time, create more instances than the specified max instances limit. If your function cannot tolerate this temporary behavior, you may want to factor in a safety margin and set a lower max instances value than your function can tolerate.

See the Max Instances Guide for more details.

Type

int

min_instance_count

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

Function instances are kept in idle state for a short period after they finished executing the request to reduce cold start time for subsequent requests. Setting a minimum instance count will ensure that the given number of instances are kept running in idle state always. This can help with cold start times when jump in incoming request count occurs after the idle instance would have been stopped in the default case.

Type

int

vpc_connector

The Serverless VPC Access connector that this cloud function can connect to. The format of this field is projects/*/locations/*/connectors/*.

Type

str

vpc_connector_egress_settings

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

Type

google.cloud.functions_v2.types.ServiceConfig.VpcConnectorEgressSettings

ingress_settings

The ingress settings for the function, controlling what traffic can reach it.

Type

google.cloud.functions_v2.types.ServiceConfig.IngressSettings

uri

Output only. URI of the Service deployed.

Type

str

service_account_email

The email of the service’s service account. If empty, defaults to {project_number}-compute@developer.gserviceaccount.com.

Type

str

all_traffic_on_latest_revision

Whether 100% of traffic is routed to the latest revision. On CreateFunction and UpdateFunction, when set to true, the revision being deployed will serve 100% of traffic, ignoring any traffic split settings, if any. On GetFunction, true will be returned if the latest revision is serving 100% of traffic.

Type

bool

secret_environment_variables

Secret environment variables configuration.

Type

MutableSequence[google.cloud.functions_v2.types.SecretEnvVar]

secret_volumes

Secret volumes configuration.

Type

MutableSequence[google.cloud.functions_v2.types.SecretVolume]

revision

Output only. The name of service revision.

Type

str

max_instance_request_concurrency

Sets the maximum number of concurrent requests that each instance can receive. Defaults to 1.

Type

int

security_level

Security level configure whether the function only accepts https. This configuration is only applicable to 1st Gen functions with Http trigger. By default https is optional for 1st Gen functions; 2nd Gen functions are https ONLY.

Type

google.cloud.functions_v2.types.ServiceConfig.SecurityLevel

binary_authorization_policy

Optional. The binary authorization policy to be checked when deploying the Cloud Run service.

Type

str

class EnvironmentVariablesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class IngressSettings(value)[source]

Bases: proto.enums.Enum

Available ingress settings.

This controls what traffic can reach the function.

If unspecified, ALLOW_ALL will be used.

Values:
INGRESS_SETTINGS_UNSPECIFIED (0):

Unspecified.

ALLOW_ALL (1):

Allow HTTP traffic from public and private sources.

ALLOW_INTERNAL_ONLY (2):

Allow HTTP traffic from only private VPC sources.

ALLOW_INTERNAL_AND_GCLB (3):

Allow HTTP traffic from private VPC sources and through GCLB.

class SecurityLevel(value)[source]

Bases: proto.enums.Enum

Available security level settings.

This enforces security protocol on function URL.

Security level is only configurable for 1st Gen functions, If unspecified, SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY.

Values:
SECURITY_LEVEL_UNSPECIFIED (0):

Unspecified.

SECURE_ALWAYS (1):

Requests for a URL that match this handler that do not use HTTPS are automatically redirected to the HTTPS URL with the same path. Query parameters are reserved for the redirect.

SECURE_OPTIONAL (2):

Both HTTP and HTTPS requests with URLs that match the handler succeed without redirects. The application can examine the request to determine which protocol was used and respond accordingly.

class VpcConnectorEgressSettings(value)[source]

Bases: proto.enums.Enum

Available egress settings.

This controls what traffic is diverted through the VPC Access Connector resource. By default PRIVATE_RANGES_ONLY will be used.

Values:
VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED (0):

Unspecified.

PRIVATE_RANGES_ONLY (1):

Use the VPC Access Connector only for private IP space from RFC1918.

ALL_TRAFFIC (2):

Force the use of VPC Access Connector for all egress traffic from the function.

class google.cloud.functions_v2.types.Source(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The location of the function source code.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

storage_source

If provided, get the source from this location in Google Cloud Storage.

This field is a member of oneof source.

Type

google.cloud.functions_v2.types.StorageSource

repo_source

If provided, get the source from this location in a Cloud Source Repository.

This field is a member of oneof source.

Type

google.cloud.functions_v2.types.RepoSource

git_uri

If provided, get the source from GitHub repository. This option is valid only for GCF 1st Gen function. Example: https://github.com/<user>/<repo>/blob/<commit>/<path-to-code>

This field is a member of oneof source.

Type

str

class google.cloud.functions_v2.types.SourceProvenance(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Provenance of the source. Ways to find the original source, or verify that some source was used for this build.

resolved_storage_source

A copy of the build’s source.storage_source, if exists, with any generations resolved.

Type

google.cloud.functions_v2.types.StorageSource

resolved_repo_source

A copy of the build’s source.repo_source, if exists, with any revisions resolved.

Type

google.cloud.functions_v2.types.RepoSource

git_uri

A copy of the build’s source.git_uri, if exists, with any commits resolved.

Type

str

class google.cloud.functions_v2.types.Stage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Each Stage of the deployment process

name

Name of the Stage. This will be unique for each Stage.

Type

google.cloud.functions_v2.types.Stage.Name

message

Message describing the Stage

Type

str

state

Current state of the Stage

Type

google.cloud.functions_v2.types.Stage.State

resource

Resource of the Stage

Type

str

resource_uri

Link to the current Stage resource

Type

str

state_messages

State messages from the current Stage.

Type

MutableSequence[google.cloud.functions_v2.types.StateMessage]

class Name(value)[source]

Bases: proto.enums.Enum

Possible names for a Stage

Values:
NAME_UNSPECIFIED (0):

Not specified. Invalid name.

ARTIFACT_REGISTRY (1):

Artifact Regsitry Stage

BUILD (2):

Build Stage

SERVICE (3):

Service Stage

TRIGGER (4):

Trigger Stage

SERVICE_ROLLBACK (5):

Service Rollback Stage

TRIGGER_ROLLBACK (6):

Trigger Rollback Stage

class State(value)[source]

Bases: proto.enums.Enum

Possible states for a Stage

Values:
STATE_UNSPECIFIED (0):

Not specified. Invalid state.

NOT_STARTED (1):

Stage has not started.

IN_PROGRESS (2):

Stage is in progress.

COMPLETE (3):

Stage has completed.

class google.cloud.functions_v2.types.StateMessage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Informational messages about the state of the Cloud Function or Operation.

severity

Severity of the state message.

Type

google.cloud.functions_v2.types.StateMessage.Severity

type_

One-word CamelCase type of the state message.

Type

str

message

The message.

Type

str

class Severity(value)[source]

Bases: proto.enums.Enum

Severity of the state message.

Values:
SEVERITY_UNSPECIFIED (0):

Not specified. Invalid severity.

ERROR (1):

ERROR-level severity.

WARNING (2):

WARNING-level severity.

INFO (3):

INFO-level severity.

class google.cloud.functions_v2.types.StorageSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Location of the source in an archive file in Google Cloud Storage.

bucket

Google Cloud Storage bucket containing the source (see Bucket Name Requirements).

Type

str

object_

Google Cloud Storage object containing the source.

This object must be a gzipped archive file (.tar.gz) containing source to build.

Type

str

generation

Google Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.

Type

int

source_upload_url

When the specified storage bucket is a 1st gen function uploard url bucket, this field should be set as the generated upload url for 1st gen deployment.

Type

str

class google.cloud.functions_v2.types.UpdateFunctionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for the UpdateFunction method.

function

Required. New version of the function.

Type

google.cloud.functions_v2.types.Function

update_mask

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

Type

google.protobuf.field_mask_pb2.FieldMask