pub struct CloudFunction {
Show 31 fields pub name: String, pub description: String, pub status: i32, pub entry_point: String, pub runtime: String, pub timeout: Option<Duration>, pub available_memory_mb: i32, pub service_account_email: String, pub update_time: Option<Timestamp>, pub version_id: i64, pub labels: BTreeMap<String, String>, pub environment_variables: BTreeMap<String, String>, pub build_environment_variables: BTreeMap<String, String>, pub network: String, pub max_instances: i32, pub min_instances: i32, pub vpc_connector: String, pub vpc_connector_egress_settings: i32, pub ingress_settings: i32, pub kms_key_name: String, pub build_worker_pool: String, pub build_id: String, pub build_name: String, pub secret_environment_variables: Vec<SecretEnvVar>, pub secret_volumes: Vec<SecretVolume>, pub source_token: String, pub docker_repository: String, pub docker_registry: i32, pub source_code: Option<SourceCode>, pub trigger: Option<Trigger>, pub runtime_update_policy: Option<RuntimeUpdatePolicy>,
}
Expand description

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

Fields§

§name: String

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

§description: String

User-provided description of a function.

§status: i32

Output only. Status of the function deployment.

§entry_point: String

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.

§runtime: String

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: Option<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: i32

The amount of memory in MB available for a function. Defaults to 256MB.

§service_account_email: String

The email of the function’s service account. If empty, defaults to {project_id}@appspot.gserviceaccount.com.

§update_time: Option<Timestamp>

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

§version_id: i64

Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.

§labels: BTreeMap<String, String>

Labels associated with this Cloud Function.

§environment_variables: BTreeMap<String, String>

Environment variables that shall be available during function execution.

§build_environment_variables: BTreeMap<String, String>

Build environment variables that shall be available during build time.

§network: String
👎Deprecated

Deprecated: use vpc_connector

§max_instances: i32

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: i32

A lower bound for the number function instances that may coexist at a given time.

§vpc_connector: String

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 for more information on connecting Cloud projects.

§vpc_connector_egress_settings: i32

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

§ingress_settings: i32

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

§kms_key_name: String

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: String

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.

§build_id: String

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

§build_name: String

Output only. The Cloud Build Name of the function deployment. projects/<project-number>/locations/<region>/builds/<build-id>.

§secret_environment_variables: Vec<SecretEnvVar>

Secret environment variables configuration.

§secret_volumes: Vec<SecretVolume>

Secret volumes configuration.

§source_token: String

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

§docker_repository: String

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: i32

Docker Registry to use for this deployment.

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.

§source_code: Option<SourceCode>

The location of the function source code.

§trigger: Option<Trigger>

An event that triggers the function.

§runtime_update_policy: Option<RuntimeUpdatePolicy>

Runtime update policy can be one of the following.

Implementations§

source§

impl CloudFunction

source

pub fn status(&self) -> CloudFunctionStatus

Returns the enum value of status, or the default if the field is set to an invalid enum value.

source

pub fn set_status(&mut self, value: CloudFunctionStatus)

Sets status to the provided enum value.

source

pub fn vpc_connector_egress_settings(&self) -> VpcConnectorEgressSettings

Returns the enum value of vpc_connector_egress_settings, or the default if the field is set to an invalid enum value.

source

pub fn set_vpc_connector_egress_settings( &mut self, value: VpcConnectorEgressSettings )

Sets vpc_connector_egress_settings to the provided enum value.

source

pub fn ingress_settings(&self) -> IngressSettings

Returns the enum value of ingress_settings, or the default if the field is set to an invalid enum value.

source

pub fn set_ingress_settings(&mut self, value: IngressSettings)

Sets ingress_settings to the provided enum value.

source

pub fn docker_registry(&self) -> DockerRegistry

Returns the enum value of docker_registry, or the default if the field is set to an invalid enum value.

source

pub fn set_docker_registry(&mut self, value: DockerRegistry)

Sets docker_registry to the provided enum value.

Trait Implementations§

source§

impl Clone for CloudFunction

source§

fn clone(&self) -> CloudFunction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CloudFunction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CloudFunction

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for CloudFunction

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for CloudFunction

source§

fn eq(&self, other: &CloudFunction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for CloudFunction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more