[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Cloud Functions V2 API - Class Google::Cloud::Functions::V2::Function (v1.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.0 (latest)](/ruby/docs/reference/google-cloud-functions-v2/latest/Google-Cloud-Functions-V2-Function)\n- [1.0.2](/ruby/docs/reference/google-cloud-functions-v2/1.0.2/Google-Cloud-Functions-V2-Function)\n- [0.10.0](/ruby/docs/reference/google-cloud-functions-v2/0.10.0/Google-Cloud-Functions-V2-Function)\n- [0.9.0](/ruby/docs/reference/google-cloud-functions-v2/0.9.0/Google-Cloud-Functions-V2-Function)\n- [0.8.1](/ruby/docs/reference/google-cloud-functions-v2/0.8.1/Google-Cloud-Functions-V2-Function)\n- [0.7.0](/ruby/docs/reference/google-cloud-functions-v2/0.7.0/Google-Cloud-Functions-V2-Function)\n- [0.6.2](/ruby/docs/reference/google-cloud-functions-v2/0.6.2/Google-Cloud-Functions-V2-Function)\n- [0.5.0](/ruby/docs/reference/google-cloud-functions-v2/0.5.0/Google-Cloud-Functions-V2-Function)\n- [0.4.1](/ruby/docs/reference/google-cloud-functions-v2/0.4.1/Google-Cloud-Functions-V2-Function)\n- [0.3.0](/ruby/docs/reference/google-cloud-functions-v2/0.3.0/Google-Cloud-Functions-V2-Function)\n- [0.2.0](/ruby/docs/reference/google-cloud-functions-v2/0.2.0/Google-Cloud-Functions-V2-Function)\n- [0.1.0](/ruby/docs/reference/google-cloud-functions-v2/0.1.0/Google-Cloud-Functions-V2-Function) \nReference documentation and code samples for the Cloud Functions V2 API class Google::Cloud::Functions::V2::Function.\n\nDescribes a Cloud Function that contains user computation executed in\nresponse to an event. It encapsulates function and trigger configurations. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #build_config\n\n def build_config() -\u003e ::Google::Cloud::Functions::V2::BuildConfig\n\n**Returns**\n\n- ([::Google::Cloud::Functions::V2::BuildConfig](./Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source.\n\n### #build_config=\n\n def build_config=(value) -\u003e ::Google::Cloud::Functions::V2::BuildConfig\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Functions::V2::BuildConfig](./Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source. \n**Returns**\n\n- ([::Google::Cloud::Functions::V2::BuildConfig](./Google-Cloud-Functions-V2-BuildConfig)) --- Describes the Build step of the function that builds a container from the given source.\n\n### #create_time\n\n def create_time() -\u003e ::Google::Protobuf::Timestamp\n\n**Returns**\n\n- ([::Google::Protobuf::Timestamp](./Google-Protobuf-Timestamp)) --- Output only. The create timestamp of a Cloud Function. This is only applicable to 2nd Gen functions.\n\n### #description\n\n def description() -\u003e ::String\n\n**Returns**\n\n- (::String) --- User-provided description of a function.\n\n### #description=\n\n def description=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- User-provided description of a function. \n**Returns**\n\n- (::String) --- User-provided description of a function.\n\n### #environment\n\n def environment() -\u003e ::Google::Cloud::Functions::V2::Environment\n\n**Returns**\n\n- ([::Google::Cloud::Functions::V2::Environment](./Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen.\n\n### #environment=\n\n def environment=(value) -\u003e ::Google::Cloud::Functions::V2::Environment\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Functions::V2::Environment](./Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen. \n**Returns**\n\n- ([::Google::Cloud::Functions::V2::Environment](./Google-Cloud-Functions-V2-Environment)) --- Describe whether the function is 1st Gen or 2nd Gen.\n\n### #event_trigger\n\n def event_trigger() -\u003e ::Google::Cloud::Functions::V2::EventTrigger\n\n**Returns**\n\n- ([::Google::Cloud::Functions::V2::EventTrigger](./Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.\n\n### #event_trigger=\n\n def event_trigger=(value) -\u003e ::Google::Cloud::Functions::V2::EventTrigger\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Functions::V2::EventTrigger](./Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service. \n**Returns**\n\n- ([::Google::Cloud::Functions::V2::EventTrigger](./Google-Cloud-Functions-V2-EventTrigger)) --- An Eventarc trigger managed by Google Cloud Functions that fires events in response to a condition in another service.\n\n### #kms_key_name\n\n def kms_key_name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources.\n\n It must match the pattern\n `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.\n\n### #kms_key_name=\n\n def kms_key_name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources.\n\n\n It must match the pattern\n`projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. \n**Returns**\n\n- (::String) --- Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources.\n\n It must match the pattern\n `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.\n\n### #labels\n\n def labels() -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Labels associated with this Cloud Function.\n\n### #labels=\n\n def labels=(value) -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Parameter**\n\n- **value** (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Labels associated with this Cloud Function. \n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Labels associated with this Cloud Function.\n\n### #name\n\n def name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`\n\n### #name=\n\n def name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*` \n**Returns**\n\n- (::String) --- A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`\n\n### #satisfies_pzs\n\n def satisfies_pzs() -\u003e ::Boolean\n\n**Returns**\n\n- (::Boolean) --- Output only. Reserved for future use.\n\n### #service_config\n\n def service_config() -\u003e ::Google::Cloud::Functions::V2::ServiceConfig\n\n**Returns**\n\n- ([::Google::Cloud::Functions::V2::ServiceConfig](./Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).\n\n### #service_config=\n\n def service_config=(value) -\u003e ::Google::Cloud::Functions::V2::ServiceConfig\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Functions::V2::ServiceConfig](./Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed). \n**Returns**\n\n- ([::Google::Cloud::Functions::V2::ServiceConfig](./Google-Cloud-Functions-V2-ServiceConfig)) --- Describes the Service being deployed. Currently deploys services to Cloud Run (fully managed).\n\n### #state\n\n def state() -\u003e ::Google::Cloud::Functions::V2::Function::State\n\n**Returns**\n\n- ([::Google::Cloud::Functions::V2::Function::State](./Google-Cloud-Functions-V2-Function-State)) --- Output only. State of the function.\n\n### #state_messages\n\n def state_messages() -\u003e ::Array\u003c::Google::Cloud::Functions::V2::StateMessage\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::Functions::V2::StateMessage](./Google-Cloud-Functions-V2-StateMessage)\\\u003e) --- Output only. State Messages for this Cloud Function.\n\n### #update_time\n\n def update_time() -\u003e ::Google::Protobuf::Timestamp\n\n**Returns**\n\n- ([::Google::Protobuf::Timestamp](./Google-Protobuf-Timestamp)) --- Output only. The last update timestamp of a Cloud Function.\n\n### #url\n\n def url() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. The deployed url for the function."]]