# Cloud Functions V2 API - Class Google::Cloud::Functions::V2::Function (v1.5.1)

1.5.1 (latest) 1.5.0 1.4.0 1.3.1 1.2.0 1.1.0 1.0.2 0.10.0 0.9.0 0.8.1 0.7.0 0.6.2 0.5.0 0.4.1 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Cloud Functions V2 API class Google::Cloud::Functions::V2::Function.

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

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #build_config

    def build_config() -> ::Google::Cloud::Functions::V2::BuildConfig

**Returns**

- ([::Google::Cloud::Functions::V2::BuildConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source.

### #build_config=

    def build_config=(value) -> ::Google::Cloud::Functions::V2::BuildConfig

**Parameter**

- **value** ([::Google::Cloud::Functions::V2::BuildConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source.
**Returns**

- ([::Google::Cloud::Functions::V2::BuildConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source.

### #create_time

    def create_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Protobuf-Timestamp)) --- Output only. The create timestamp of a Cloud Function. This is only applicable to 2nd Gen functions.

### #description

    def description() -> ::String

**Returns**

- (::String) --- User-provided description of a function.

### #description=

    def description=(value) -> ::String

**Parameter**

- **value** (::String) --- User-provided description of a function.
**Returns**

- (::String) --- User-provided description of a function.

### #environment

    def environment() -> ::Google::Cloud::Functions::V2::Environment

**Returns**

- ([::Google::Cloud::Functions::V2::Environment](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen.

### #environment=

    def environment=(value) -> ::Google::Cloud::Functions::V2::Environment

**Parameter**

- **value** ([::Google::Cloud::Functions::V2::Environment](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen.
**Returns**

- ([::Google::Cloud::Functions::V2::Environment](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen.

### #event_trigger

    def event_trigger() -> ::Google::Cloud::Functions::V2::EventTrigger

**Returns**

- ([::Google::Cloud::Functions::V2::EventTrigger](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.

### #event_trigger=

    def event_trigger=(value) -> ::Google::Cloud::Functions::V2::EventTrigger

**Parameter**

- **value** ([::Google::Cloud::Functions::V2::EventTrigger](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.
**Returns**

- ([::Google::Cloud::Functions::V2::EventTrigger](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.

### #kms_key_name

    def kms_key_name() -> ::String

**Returns**

- (::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}`.

### #kms_key_name=

    def kms_key_name=(value) -> ::String

**Parameter**

- **value** (::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}`.
**Returns**

- (::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}`.

### #labels

    def labels() -> ::Google::Protobuf::Map{::String => ::String}

**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this Cloud Function.

### #labels=

    def labels=(value) -> ::Google::Protobuf::Map{::String => ::String}

**Parameter**

- **value** (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this Cloud Function.
**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Labels associated with this Cloud Function.

### #name

    def name() -> ::String

**Returns**

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

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::String) --- A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`
**Returns**

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

### #satisfies_pzs

    def satisfies_pzs() -> ::Boolean

**Returns**

- (::Boolean) --- Output only. Reserved for future use.

### #service_config

    def service_config() -> ::Google::Cloud::Functions::V2::ServiceConfig

**Returns**

- ([::Google::Cloud::Functions::V2::ServiceConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).

### #service_config=

    def service_config=(value) -> ::Google::Cloud::Functions::V2::ServiceConfig

**Parameter**

- **value** ([::Google::Cloud::Functions::V2::ServiceConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).
**Returns**

- ([::Google::Cloud::Functions::V2::ServiceConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).

### #state

    def state() -> ::Google::Cloud::Functions::V2::Function::State

**Returns**

- ([::Google::Cloud::Functions::V2::Function::State](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-Function-State)) --- Output only. State of the function.

### #state_messages

    def state_messages() -> ::Array<::Google::Cloud::Functions::V2::StateMessage>

**Returns**

- (::Array\<[::Google::Cloud::Functions::V2::StateMessage](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-StateMessage)\>) --- Output only. State Messages for this Cloud Function.

### #update_time

    def update_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Protobuf-Timestamp)) --- Output only. The last update timestamp of a Cloud Function.

### #url

    def url() -> ::String

**Returns**

- (::String) --- Output only. The deployed url for the function.