Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparing with other Yandex Cloud services
    • Overview
      • Overview
      • Top-level function
      • YcFunction interface
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Error handling
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ
  1. Developing in Kotlin
  2. Programming model
  3. YcFunction interface

Using the YcFunction interface for a handler in Kotlin

Written by
Yandex Cloud
Updated at July 2, 2026
View as Markdown

To create a handler in Kotlin, you can implement the YcFunction interface. To do this, add the SDK to the dependencies.

Here is an example of a handler:

import yandex.cloud.sdk.functions.YcFunction
import yandex.cloud.sdk.functions.Context

class Handler : YcFunction<Int, Int> {
    override fun handle(event: Int, context: Context?): Int {
        return event
    }
}

Warning

Specify two values for YcFunction type parameters: the first one being the input argument type and the second one, the return value type. For the handle method, make sure to provide the invocation context as its second argument.

You can use any classes as input and return types. Fields of these classes can have any access modifiers.

Was the article helpful?

Previous
Top-level function
Next
Managing dependencies
© 2026 Direct Cursus Technology L.L.C.