Updates existing function.
Scopes
You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.
If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform.
You can set the scope for this method like this: cloudfunctions1 --scope <scope> projects locations-functions-patch ...
Required Scalar Argument
- <name> (string)
- A user-defined name of the function. Function names must be unique globally and match pattern
projects/*/locations/*/functions/*
- A user-defined name of the function. Function names must be unique globally and match pattern
Required Request Value
The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.
For example, a structure like this:
CloudFunction:
available-memory-mb: integer
build-environment-variables: { string: string }
build-id: string
build-name: string
build-service-account: string
build-worker-pool: string
description: string
docker-registry: string
docker-repository: string
entry-point: string
environment-variables: { string: string }
event-trigger:
event-type: string
resource: string
service: string
https-trigger:
security-level: string
url: string
ingress-settings: string
kms-key-name: string
labels: { string: string }
max-instances: integer
min-instances: integer
name: string
network: string
on-deploy-update-policy:
runtime-version: string
runtime: string
service-account-email: string
source-archive-url: string
source-repository:
deployed-url: string
url: string
source-token: string
source-upload-url: string
status: string
timeout: string
update-time: string
version-id: string
vpc-connector: string
vpc-connector-egress-settings: string
can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.
-r . available-memory-mb=21
- The amount of memory in MB available for a function. Defaults to 256MB.
build-environment-variables=key=no
- Build environment variables that shall be available during build time.
- the value will be associated with the given
key
build-id=stet
- Output only. The Cloud Build ID of the latest successful deployment of the function.
build-name=kasd
- Output only. The Cloud Build Name of the function deployment.
projects//locations//builds/
.
- Output only. The Cloud Build Name of the function deployment.
build-service-account=et
- Optional. A service account the user provides for use with Cloud Build.
build-worker-pool=sed
- 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-@gcf-admin-robot.iam.gserviceaccount.com
) must be granted the role Cloud Build Custom Workers Builder (roles/cloudbuild.customworkers.builder
) in the project.
- Name of the Cloud Build Custom Worker Pool that should be used to build the function. The format of this field is
description=et
- User-provided description of a function.
docker-registry=et
- Docker Registry to use for this deployment. If unspecified, it defaults to
ARTIFACT_REGISTRY
. Ifdocker_repository
field is specified, this field should either be left unspecified or set toARTIFACT_REGISTRY
.
- Docker Registry to use for this deployment. If unspecified, it defaults to
docker-repository=vero
- 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'.
- 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
entry-point=erat
- The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix (ID of the function), if not specified.
environment-variables=key=sed
- Environment variables that shall be available during function execution.
- the value will be associated with the given
key
event-trigger event-type=duo
- Required. The type of event to observe. For example:
providers/cloud.storage/eventTypes/object.change
andproviders/cloud.pubsub/eventTypes/topic.publish
. Event types match patternproviders/*/eventTypes/*.*
. The pattern contains: 1. namespace: For example,cloud.storage
andgoogle.firebase.analytics
. 2. resource type: The type of resource on which event occurs. For example, the Google Cloud Storage API includes the typeobject
. 3. action: The action that generates the event. For example, action for a Google Cloud Storage Object is 'change'. These parts are lower case.
- Required. The type of event to observe. For example:
resource=dolore
- Required. The resource(s) from which to observe events, for example,
projects/_/buckets/myBucket
. Not all syntactically correct values are accepted by all services. For example: 1. The authorization model must support it. Google Cloud Functions only allows EventTriggers to be deployed that observe resources in the same project as theCloudFunction
. 2. The resource type must match the pattern expected for anevent_type
. For example, anEventTrigger
that has anevent_type
of "google.pubsub.topic.publish" should have a resource that matches Google Cloud Pub/Sub topics. Additionally, some services may support short names when creating anEventTrigger
. These will always be returned in the normalized "long" format. See each service's documentation for supported formats.
- Required. The resource(s) from which to observe events, for example,
-
service=et
- The hostname of the service that 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 thegoogle.storage
namespace.
- The hostname of the service that should be observed. If no string is provided, the default service implementing the API will be used. For example,
-
..https-trigger security-level=voluptua.
- The security level for the function.
-
url=amet.
- Output only. The deployed url for the function.
-
.. ingress-settings=consetetur
- The ingress settings for the function, controlling what traffic can reach it.
kms-key-name=diam
- 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 thedocker_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.
- Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. It must match the pattern
labels=key=dolor
- Labels associated with this Cloud Function.
- the value will be associated with the given
key
max-instances=83
- 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.
min-instances=79
- A lower bound for the number function instances that may coexist at a given time.
name=sadipscing
- A user-defined name of the function. Function names must be unique globally and match pattern
projects/*/locations/*/functions/*
- A user-defined name of the function. Function names must be unique globally and match pattern
network=stet
- Deprecated: use vpc_connector
-
on-deploy-update-policy runtime-version=dolor
- Output only. contains the runtime version which was used during latest function deployment.
-
.. runtime=duo
- 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.
- 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
service-account-email=vero
- The email of the function's service account. If empty, defaults to
{project_id}@appspot.gserviceaccount.com
.
- The email of the function's service account. If empty, defaults to
source-archive-url=vero
- The Google Cloud Storage URL, starting with
gs://
, pointing to the zip archive which contains the function.
- The Google Cloud Storage URL, starting with
source-repository deployed-url=invidunt
- Output only. The URL pointing to the hosted repository where the function were defined at the time of deployment. It always points to a specific commit in the format described above.
-
url=stet
- The URL pointing to the hosted repository where the function is defined. There are supported Cloud Source Repository URLs in the following formats: To refer to a specific commit:
https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*
To refer to a moveable alias (branch):https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*
In particular, to refer to HEAD usemaster
moveable alias. To refer to a specific fixed alias (tag):https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*
You may omitpaths/*
if you want to use the main directory.
- The URL pointing to the hosted repository where the function is defined. There are supported Cloud Source Repository URLs in the following formats: To refer to a specific commit:
-
.. source-token=vero
- Input only. An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.
source-upload-url=elitr
- 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)
status=lorem
- Output only. Status of the function deployment.
timeout=diam
- 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.
update-time=no
- Output only. The last update timestamp of a Cloud Function.
version-id=ipsum
- Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.
vpc-connector=accusam
- 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 withnetwork
field and will eventually replace it. See the VPC documentation for more information on connecting Cloud projects.
- 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
vpc-connector-egress-settings=takimata
- The egress settings for the connector, controlling what traffic is diverted through it.
About Cursors
The cursor position is key to comfortably set complex nested structures. The following rules apply:
- The cursor position is always set relative to the current one, unless the field name starts with the
.
character. Fields can be nested such as in-r f.s.o
. - The cursor position is set relative to the top-level structure if it starts with
.
, e.g.-r .s.s
- You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify
-r struct.sub_struct=bar
. - You can move the cursor one level up by using
..
. Each additional.
moves it up one additional level. E.g....
would go three levels up.
Optional Output Flags
The method's return value a JSON encoded structure, which will be written to standard output by default.
- -o out
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
-
to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
Optional Method Properties
You may set the following properties to further configure the call. Please note that -p
is followed by one
or more key-value-pairs, and is called like this -p k1=v1 k2=v2
even though the listing below repeats the
-p
for completeness.
- -p update-mask=string
- Required. The list of fields in
CloudFunction
that have to be updated.
- Required. The list of fields in
Optional General Properties
The following properties can configure any call, and are not specific to this method.
-
-p $-xgafv=string
- V1 error format.
-
-p access-token=string
- OAuth access token.
-
-p alt=string
- Data format for response.
-
-p callback=string
- JSONP
-
-p fields=string
- Selector specifying which fields to include in a partial response.
-
-p key=string
- API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
-
-p oauth-token=string
- OAuth 2.0 token for the current user.
-
-p pretty-print=boolean
- Returns response with indentations and line breaks.
-
-p quota-user=string
- Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
-
-p upload-type=string
- Legacy upload protocol for media (e.g. "media", "multipart").
-
-p upload-protocol=string
- Upload protocol for media (e.g. "raw", "multipart").