Class CloudFunction (1.12.0)

CloudFunction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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

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.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes

NameDescription
name str
A user-defined name of the function. Function names must be unique globally and match pattern projects/*/locations/*/functions/*
description str
User-provided description of a function.
source_archive_url str
The Google Cloud Storage URL, starting with gs://, pointing to the zip archive which contains the function. This field is a member of oneof_ source_code.
source_repository google.cloud.functions_v1.types.SourceRepository
**Beta Feature** The source repository where a function is hosted. This field is a member of oneof_ source_code.
source_upload_url str
The Google Cloud Storage signed URL used for source uploading, generated by calling [google.cloud.functions.v1.GenerateUploadUrl]. The signature is validated on write methods (Create, Update) The signature is stripped from the Function object on read methods (Get, List) This field is a member of oneof_ source_code.
https_trigger google.cloud.functions_v1.types.HttpsTrigger
An HTTPS endpoint type of source that can be triggered via URL. This field is a member of oneof_ trigger.
event_trigger google.cloud.functions_v1.types.EventTrigger
A source that fires events in response to a condition in another service. This field is a member of oneof_ trigger.
status google.cloud.functions_v1.types.CloudFunctionStatus
Output only. Status of the function deployment.
entry_point str
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.
runtime str
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
timeout google.protobuf.duration_pb2.Duration
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.
available_memory_mb int
The amount of memory in MB available for a function. Defaults to 256MB.
service_account_email str
The email of the function's service account. If empty, defaults to {project_id}@appspot.gserviceaccount.com.
update_time google.protobuf.timestamp_pb2.Timestamp
Output only. The last update timestamp of a Cloud Function.
version_id int
Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.
labels MutableMapping[str, str]
Labels associated with this Cloud Function.
environment_variables MutableMapping[str, str]
Environment variables that shall be available during function execution.
build_environment_variables MutableMapping[str, str]
Build environment variables that shall be available during build time.
network str
The VPC Network that this cloud function can connect to. It can be either the fully-qualified URI, or the short name of the network resource. If the short network name is used, the network must belong to the same project. Otherwise, it must belong to a project within the same organization. The format of this field is either projects/{project}/global/networks/{network} or {network}, where {project} is a project id where the network is defined, and {network} is the short name of the network. This field is mutually exclusive with vpc_connector and will be replaced by it. See `the VPC documentation
max_instances int
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
min_instances int
A lower bound for the number function instances that may coexist at a given time.
vpc_connector str
The VPC Network Connector that this cloud function can connect to. It can be either the fully-qualified URI, or the short name of the network connector resource. The format of this field is projects/*/locations/*/connectors/* This field is mutually exclusive with network field and will eventually replace it. See `the VPC documentation
vpc_connector_egress_settings google.cloud.functions_v1.types.CloudFunction.VpcConnectorEgressSettings
The egress settings for the connector, controlling what traffic is diverted through it.
ingress_settings google.cloud.functions_v1.types.CloudFunction.IngressSettings
The ingress settings for the function, controlling what traffic can reach it.
kms_key_name str
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}. If specified, you must also provide an artifact registry repository using the docker_repository field that was created with the same KMS crypto key. The following service accounts need to be granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the Key/KeyRing/Project/Organization (least access preferred). 1. Google Cloud Functions service account (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - Required to protect the function's image. 2. Google Storage service account (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - Required to protect the function's source code. If this service account does not exist, deploying a function without a KMS key or retrieving the service agent name provisions it. For more information, see https://cloud.google.com/storage/docs/projects#service-agents and https://cloud.google.com/storage/docs/getting-service-agent#gsutil. Google Cloud Functions delegates access to service agents to protect function resources in internal projects that are not accessible by the end user.
build_worker_pool str
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-) must be granted the role Cloud Build Custom Workers Builder (roles/cloudbuild.customworkers.builder) in the project.
build_id str
Output only. The Cloud Build ID of the latest successful deployment of the function.
build_name str
Output only. The Cloud Build Name of the function deployment. projects/.
secret_environment_variables MutableSequence[google.cloud.functions_v1.types.SecretEnvVar]
Secret environment variables configuration.
secret_volumes MutableSequence[google.cloud.functions_v1.types.SecretVolume]
Secret volumes configuration.
source_token str
Input only. An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.
docker_repository str
User managed repository created in Artifact Registry optionally with a customer managed encryption key. If specified, deployments will use Artifact Registry. If unspecified and the deployment is eligible to use Artifact Registry, GCF will create and use a repository named 'gcf-artifacts' for every deployed region. This is the repository to which the function docker image will be pushed after it is built by Cloud Build. 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'.
docker_registry google.cloud.functions_v1.types.CloudFunction.DockerRegistry
Docker Registry to use for this deployment. If docker_repository field is specified, this field will be automatically set as ARTIFACT_REGISTRY. If unspecified, it currently defaults to CONTAINER_REGISTRY. This field may be overridden by the backend for eligible deployments.

Classes

BuildEnvironmentVariablesEntry

BuildEnvironmentVariablesEntry(
    mapping=None, *, ignore_unknown_fields=False, **kwargs
)

The abstract base class for a message.

Parameters
NameDescription
kwargs dict

Keys and values corresponding to the fields of the message.

mapping Union[dict, .Message]

A dictionary or message to be used to determine the values for this message.

ignore_unknown_fields Optional(bool)

If True, do not raise errors for unknown fields. Only applied if mapping is a mapping type or there are keyword parameters.

DockerRegistry

DockerRegistry(value)

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.

EnvironmentVariablesEntry

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

The abstract base class for a message.

Parameters
NameDescription
kwargs dict

Keys and values corresponding to the fields of the message.

mapping Union[dict, .Message]

A dictionary or message to be used to determine the values for this message.

ignore_unknown_fields Optional(bool)

If True, do not raise errors for unknown fields. Only applied if mapping is a mapping type or there are keyword parameters.

IngressSettings

IngressSettings(value)

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.

LabelsEntry

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

The abstract base class for a message.

Parameters
NameDescription
kwargs dict

Keys and values corresponding to the fields of the message.

mapping Union[dict, .Message]

A dictionary or message to be used to determine the values for this message.

ignore_unknown_fields Optional(bool)

If True, do not raise errors for unknown fields. Only applied if mapping is a mapping type or there are keyword parameters.

VpcConnectorEgressSettings

VpcConnectorEgressSettings(value)

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.