Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • Машинное обучение
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Истории успеха
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Документация
  • Блог
Проект Яндекса
© 2025 ООО «Яндекс.Облако»
Yandex Cloud Functions
  • Сопоставление с другими сервисами Yandex Cloud
  • Инструменты
  • Правила тарификации
  • Управление доступом
  • Справочник Terraform
    • Аутентификация в API
      • Overview
        • Overview
        • Get
        • List
        • Create
        • Update
        • Delete
        • GetVersion
        • GetVersionByTag
        • ListVersions
        • DeleteVersion
        • SetTag
        • RemoveTag
        • ListTagHistory
        • CreateVersion
        • ListRuntimes
        • ListOperations
        • ListAccessBindings
        • SetAccessBindings
        • UpdateAccessBindings
        • ListScalingPolicies
        • SetScalingPolicy
        • RemoveScalingPolicy
  • Метрики Monitoring
  • Аудитные логи Audit Trails
  • История изменений
  • Вопросы и ответы
  • Обучающие курсы

В этой статье:

  • HTTP request
  • Body parameters
  • Resources
  • Package
  • Connectivity
  • Secret
  • LogOptions
  • StorageMount
  • AsyncInvocationConfig
  • ResponseTarget
  • YMQTarget
  • Mount
  • ObjectStorage
  • DiskSpec
  • MetadataOptions
  • Response
  • CreateFunctionVersionMetadata
  • Status
  • Version
  • Resources
  • Connectivity
  • Secret
  • LogOptions
  • StorageMount
  • AsyncInvocationConfig
  • ResponseTarget
  • YMQTarget
  • Mount
  • ObjectStorage
  • DiskSpec
  • MetadataOptions
  1. Справочник API Functions
  2. REST (англ.)
  3. Function
  4. CreateVersion

Cloud Functions Service, REST: Function.CreateVersion

Статья создана
Yandex Cloud
Обновлена 17 декабря 2024 г.
  • HTTP request
  • Body parameters
  • Resources
  • Package
  • Connectivity
  • Secret
  • LogOptions
  • StorageMount
  • AsyncInvocationConfig
  • ResponseTarget
  • YMQTarget
  • Mount
  • ObjectStorage
  • DiskSpec
  • MetadataOptions
  • Response
  • CreateFunctionVersionMetadata
  • Status
  • Version
  • Resources
  • Connectivity
  • Secret
  • LogOptions
  • StorageMount
  • AsyncInvocationConfig
  • ResponseTarget
  • YMQTarget
  • Mount
  • ObjectStorage
  • DiskSpec
  • MetadataOptions

Creates a version for the specified function.

HTTP requestHTTP request

POST https://serverless-functions.api.cloud.yandex.net/functions/v1/versions

Body parametersBody parameters

{
  "functionId": "string",
  "runtime": "string",
  "description": "string",
  "entrypoint": "string",
  "resources": {
    "memory": "string"
  },
  "executionTimeout": "string",
  "serviceAccountId": "string",
  // Includes only one of the fields `package`, `content`, `versionId`
  "package": {
    "bucketName": "string",
    "objectName": "string",
    "sha256": "string"
  },
  "content": "string",
  "versionId": "string",
  // end of the list of possible fields
  "environment": "object",
  "tag": [
    "string"
  ],
  "connectivity": {
    "networkId": "string",
    "subnetId": [
      "string"
    ]
  },
  "namedServiceAccounts": "object",
  "secrets": [
    {
      "id": "string",
      "versionId": "string",
      "key": "string",
      // Includes only one of the fields `environmentVariable`
      "environmentVariable": "string"
      // end of the list of possible fields
    }
  ],
  "logOptions": {
    "disabled": "boolean",
    // Includes only one of the fields `logGroupId`, `folderId`
    "logGroupId": "string",
    "folderId": "string",
    // end of the list of possible fields
    "minLevel": "string"
  },
  "storageMounts": [
    {
      "bucketId": "string",
      "prefix": "string",
      "mountPointName": "string",
      "readOnly": "boolean"
    }
  ],
  "asyncInvocationConfig": {
    "retriesCount": "string",
    "successTarget": {
      // Includes only one of the fields `emptyTarget`, `ymqTarget`
      "emptyTarget": "object",
      "ymqTarget": {
        "queueArn": "string",
        "serviceAccountId": "string"
      }
      // end of the list of possible fields
    },
    "failureTarget": {
      // Includes only one of the fields `emptyTarget`, `ymqTarget`
      "emptyTarget": "object",
      "ymqTarget": {
        "queueArn": "string",
        "serviceAccountId": "string"
      }
      // end of the list of possible fields
    },
    "serviceAccountId": "string"
  },
  "tmpfsSize": "string",
  "concurrency": "string",
  "mounts": [
    {
      "name": "string",
      "mode": "string",
      // Includes only one of the fields `objectStorage`, `ephemeralDiskSpec`
      "objectStorage": {
        "bucketId": "string",
        "prefix": "string"
      },
      "ephemeralDiskSpec": {
        "size": "string",
        "blockSize": "string"
      }
      // end of the list of possible fields
    }
  ],
  "metadataOptions": {
    "gceHttpEndpoint": "string",
    "awsV1HttpEndpoint": "string"
  }
}

Field

Description

functionId

string

Required field. ID of the function to create a version for.

To get a function ID, make a FunctionService.List request.

runtime

string

Required field. Runtime environment for the version.

description

string

Description of the version

entrypoint

string

Required field. Entrypoint of the version.

resources

Resources

Required field. Resources allocated to the version.

executionTimeout

string (duration)

Required field. Timeout for the execution of the version.

If the timeout is exceeded, Cloud Functions responds with a 504 HTTP code.

serviceAccountId

string

ID of the service account to associate with the version.

package

Package

Functions deployment package.

Includes only one of the fields package, content, versionId.

Source of the deployment package for the version.

content

string (bytes)

Content of the deployment package.

Includes only one of the fields package, content, versionId.

Source of the deployment package for the version.

versionId

string

ID of the version to be copied from. Source version must belong to the same folder as the created version
and the user must have read permissions to the source version.

Includes only one of the fields package, content, versionId.

Source of the deployment package for the version.

environment

object (map<string, string>)

Environment settings for the version.

tag[]

string

Function version tags. For details, see Version tag.

connectivity

Connectivity

Function version connectivity. If specified the version will be attached to specified network/subnet(s).

namedServiceAccounts

object (map<string, string>)

Additional service accounts to be used by the version.

secrets[]

Secret

Yandex Lockbox secrets to be used by the version.

logOptions

LogOptions

Options for logging from the function

storageMounts[]

StorageMount

S3 mounts to be used by the version.

asyncInvocationConfig

AsyncInvocationConfig

Config for asynchronous invocations of the version

tmpfsSize

string (int64)

Optional size of in-memory mounted /tmp directory in bytes.
Available for versions with resources.memory greater or equal to 1024 MiB.

0 or in range from 512 MiB to 3/4 of resources.memory.

concurrency

string (int64)

The maximum number of requests processed by a function instance at the same time

mounts[]

Mount

Mounts to be used by the version.

metadataOptions

MetadataOptions

Metadata options for the version.

ResourcesResources

Resources allocated to a version.

Field

Description

memory

string (int64)

Amount of memory available to the version, specified in bytes, multiple of 128MB.

PackagePackage

Version deployment package.

Field

Description

bucketName

string

Required field. Name of the bucket that stores the code for the version.

objectName

string

Required field. Name of the object in the bucket that stores the code for the version.

sha256

string

SHA256 hash of the version deployment package.

ConnectivityConnectivity

Version connectivity specification.

Field

Description

networkId

string

Network the version will have access to.
It's essential to specify network with subnets in all availability zones.

subnetId[]

string

Complete list of subnets (from the same network) the version can be attached to.
It's essential to specify at least one subnet for each availability zones.

SecretSecret

Secret for serverless function.

Field

Description

id

string

ID of Yandex Lockbox secret.

versionId

string

ID of Yandex Lockbox version.

key

string

Key in secret's payload, which value to be delivered into function environment.

environmentVariable

string

environment variable in which secret's value to be delivered.

Includes only one of the fields environmentVariable.

LogOptionsLogOptions

Field

Description

disabled

boolean

Is logging from function disabled.

logGroupId

string

Entry should be written to log group resolved by ID.

Includes only one of the fields logGroupId, folderId.

Log entries destination.

folderId

string

Entry should be written to default log group for specified folder.

Includes only one of the fields logGroupId, folderId.

Log entries destination.

minLevel

enum (Level)

Minimum log entry level.

See LogLevel.Level for details.

  • LEVEL_UNSPECIFIED: Default log level.

    Equivalent to not specifying log level at all.

  • TRACE: Trace log level.

    Possible use case: verbose logging of some business logic.

  • DEBUG: Debug log level.

    Possible use case: debugging special cases in application logic.

  • INFO: Info log level.

    Mostly used for information messages.

  • WARN: Warn log level.

    May be used to alert about significant events.

  • ERROR: Error log level.

    May be used to alert about errors in infrastructure, logic, etc.

  • FATAL: Fatal log level.

    May be used to alert about unrecoverable failures and events.

StorageMountStorageMount

Field

Description

bucketId

string

Required field. S3 bucket name for mounting.

prefix

string

S3 bucket prefix for mounting.

mountPointName

string

Required field. Mount point directory name (not path) for mounting.

readOnly

boolean

Is mount read only.

AsyncInvocationConfigAsyncInvocationConfig

Field

Description

retriesCount

string (int64)

Number of retries of version invocation

successTarget

ResponseTarget

Required field. Target for successful result of the version's invocation

failureTarget

ResponseTarget

Required field. Target for unsuccessful result, if all retries failed

serviceAccountId

string

Service account which can invoke version

ResponseTargetResponseTarget

Target to which a result of an invocation will be sent

Field

Description

emptyTarget

object

Target to ignore a result

Includes only one of the fields emptyTarget, ymqTarget.

ymqTarget

YMQTarget

Target to send a result to ymq

Includes only one of the fields emptyTarget, ymqTarget.

YMQTargetYMQTarget

Field

Description

queueArn

string

Required field. Queue ARN

serviceAccountId

string

Required field. Service account which has write permission on the queue.

MountMount

Mount contains an information about version's external storage mount

Field

Description

name

string

Required field. Unique mount point name. Device will be mounted into /function/storage/

mode

enum (Mode)

Mount's mode

  • MODE_UNSPECIFIED
  • READ_ONLY
  • READ_WRITE

objectStorage

ObjectStorage

Object storage mounts

Includes only one of the fields objectStorage, ephemeralDiskSpec.

Target mount option

ephemeralDiskSpec

DiskSpec

Working disk (worker-local non-shared read-write NBS disk templates)

Includes only one of the fields objectStorage, ephemeralDiskSpec.

Target mount option

ObjectStorageObjectStorage

ObjectStorage as a mount

Field

Description

bucketId

string

Required field. ObjectStorage bucket name for mounting.

prefix

string

ObjectStorage bucket prefix for mounting.

DiskSpecDiskSpec

Disk as a mount

Field

Description

size

string (int64)

The size of disk for mount in bytes

blockSize

string (int64)

Optional block size of disk for mount in bytes

MetadataOptionsMetadataOptions

Field

Description

gceHttpEndpoint

enum (MetadataOption)

Enabled access to GCE flavored metadata

  • METADATA_OPTION_UNSPECIFIED: Option is default
  • ENABLED: Option is enabled
  • DISABLED: Option is disabled

awsV1HttpEndpoint

enum (MetadataOption)

Enabled access to AWS flavored metadata (IMDSv1)

  • METADATA_OPTION_UNSPECIFIED: Option is default
  • ENABLED: Option is enabled
  • DISABLED: Option is disabled

ResponseResponse

HTTP Code: 200 - OK

{
  "id": "string",
  "description": "string",
  "createdAt": "string",
  "createdBy": "string",
  "modifiedAt": "string",
  "done": "boolean",
  "metadata": {
    "functionVersionId": "string"
  },
  // Includes only one of the fields `error`, `response`
  "error": {
    "code": "integer",
    "message": "string",
    "details": [
      "object"
    ]
  },
  "response": {
    "id": "string",
    "functionId": "string",
    "description": "string",
    "createdAt": "string",
    "runtime": "string",
    "entrypoint": "string",
    "resources": {
      "memory": "string"
    },
    "executionTimeout": "string",
    "serviceAccountId": "string",
    "imageSize": "string",
    "status": "string",
    "tags": [
      "string"
    ],
    "environment": "object",
    "connectivity": {
      "networkId": "string",
      "subnetId": [
        "string"
      ]
    },
    "namedServiceAccounts": "object",
    "secrets": [
      {
        "id": "string",
        "versionId": "string",
        "key": "string",
        // Includes only one of the fields `environmentVariable`
        "environmentVariable": "string"
        // end of the list of possible fields
      }
    ],
    "logOptions": {
      "disabled": "boolean",
      // Includes only one of the fields `logGroupId`, `folderId`
      "logGroupId": "string",
      "folderId": "string",
      // end of the list of possible fields
      "minLevel": "string"
    },
    "storageMounts": [
      {
        "bucketId": "string",
        "prefix": "string",
        "mountPointName": "string",
        "readOnly": "boolean"
      }
    ],
    "asyncInvocationConfig": {
      "retriesCount": "string",
      "successTarget": {
        // Includes only one of the fields `emptyTarget`, `ymqTarget`
        "emptyTarget": "object",
        "ymqTarget": {
          "queueArn": "string",
          "serviceAccountId": "string"
        }
        // end of the list of possible fields
      },
      "failureTarget": {
        // Includes only one of the fields `emptyTarget`, `ymqTarget`
        "emptyTarget": "object",
        "ymqTarget": {
          "queueArn": "string",
          "serviceAccountId": "string"
        }
        // end of the list of possible fields
      },
      "serviceAccountId": "string"
    },
    "tmpfsSize": "string",
    "concurrency": "string",
    "mounts": [
      {
        "name": "string",
        "mode": "string",
        // Includes only one of the fields `objectStorage`, `ephemeralDiskSpec`
        "objectStorage": {
          "bucketId": "string",
          "prefix": "string"
        },
        "ephemeralDiskSpec": {
          "size": "string",
          "blockSize": "string"
        }
        // end of the list of possible fields
      }
    ],
    "metadataOptions": {
      "gceHttpEndpoint": "string",
      "awsV1HttpEndpoint": "string"
    }
  }
  // end of the list of possible fields
}

An Operation resource. For more information, see Operation.

Field

Description

id

string

ID of the operation.

description

string

Description of the operation. 0-256 characters long.

createdAt

string (date-time)

Creation timestamp.

String in RFC3339 text format. The range of possible values is from
0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the
Protocol Buffers reference.
In some languages, built-in datetime utilities do not support nanosecond precision (9 digits).

createdBy

string

ID of the user or service account who initiated the operation.

modifiedAt

string (date-time)

The time when the Operation resource was last modified.

String in RFC3339 text format. The range of possible values is from
0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the
Protocol Buffers reference.
In some languages, built-in datetime utilities do not support nanosecond precision (9 digits).

done

boolean

If the value is false, it means the operation is still in progress.
If true, the operation is completed, and either error or response is available.

metadata

CreateFunctionVersionMetadata

Service-specific metadata associated with the operation.
It typically contains the ID of the target resource that the operation is performed on.
Any method that returns a long-running operation should document the metadata type, if any.

error

Status

The error result of the operation in case of failure or cancellation.

Includes only one of the fields error, response.

The operation result.
If done == false and there was no failure detected, neither error nor response is set.
If done == false and there was a failure detected, error is set.
If done == true, exactly one of error or response is set.

response

Version

The normal response of the operation in case of success.
If the original method returns no data on success, such as Delete,
the response is google.protobuf.Empty.
If the original method is the standard Create/Update,
the response should be the target resource of the operation.
Any method that returns a long-running operation should document the response type, if any.

Includes only one of the fields error, response.

The operation result.
If done == false and there was no failure detected, neither error nor response is set.
If done == false and there was a failure detected, error is set.
If done == true, exactly one of error or response is set.

CreateFunctionVersionMetadataCreateFunctionVersionMetadata

Field

Description

functionVersionId

string

ID of the version that is being created.

StatusStatus

The error result of the operation in case of failure or cancellation.

Field

Description

code

integer (int32)

Error code. An enum value of google.rpc.Code.

message

string

An error message.

details[]

object

A list of messages that carry the error details.

VersionVersion

Version of a function. For details about the concept, see Function versions.

Field

Description

id

string

ID of the version.

functionId

string

ID of the function that the version belongs to.

description

string

Description of the version.

createdAt

string (date-time)

Creation timestamp for the version.

String in RFC3339 text format. The range of possible values is from
0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the
Protocol Buffers reference.
In some languages, built-in datetime utilities do not support nanosecond precision (9 digits).

runtime

string

ID of the runtime environment for the function.

Supported environments and their identifiers are listed in the Runtime environments.

entrypoint

string

Entrypoint for the function: the name of the function to be called as the handler.

Specified in the format <function file name>.<handler name>, for example, index.myFunction.

resources

Resources

Resources allocated to the version.

executionTimeout

string (duration)

Timeout for the execution of the version.

If the timeout is exceeded, Cloud Functions responds with a 504 HTTP code.

serviceAccountId

string

ID of the service account associated with the version.

imageSize

string (int64)

Final size of the deployment package after unpacking.

status

enum (Status)

Status of the version.

  • STATUS_UNSPECIFIED
  • CREATING: Version is being created.
  • ACTIVE: Version is ready to use.
  • OBSOLETE: Version will be deleted soon.
  • DELETING: Version is being deleted.

tags[]

string

Version tags. For details, see Version tag.

environment

object (map<string, string>)

Environment settings for the version.

connectivity

Connectivity

Network access. If specified the version will be attached to specified network/subnet(s).

namedServiceAccounts

object (map<string, string>)

Additional service accounts to be used by the version.

secrets[]

Secret

Yandex Lockbox secrets to be used by the version.

logOptions

LogOptions

Options for logging from the function

storageMounts[]

StorageMount

S3 mounts to be used by the version.

asyncInvocationConfig

AsyncInvocationConfig

Config for asynchronous invocations of the version

tmpfsSize

string (int64)

Optional size of in-memory mounted /tmp directory in bytes.

concurrency

string (int64)

The maximum number of requests processed by a function instance at the same time

mounts[]

Mount

Mounts to be used by the version.

metadataOptions

MetadataOptions

Metadata options for the version.

ResourcesResources

Resources allocated to a version.

Field

Description

memory

string (int64)

Amount of memory available to the version, specified in bytes, multiple of 128MB.

ConnectivityConnectivity

Version connectivity specification.

Field

Description

networkId

string

Network the version will have access to.
It's essential to specify network with subnets in all availability zones.

subnetId[]

string

Complete list of subnets (from the same network) the version can be attached to.
It's essential to specify at least one subnet for each availability zones.

SecretSecret

Secret for serverless function.

Field

Description

id

string

ID of Yandex Lockbox secret.

versionId

string

ID of Yandex Lockbox version.

key

string

Key in secret's payload, which value to be delivered into function environment.

environmentVariable

string

environment variable in which secret's value to be delivered.

Includes only one of the fields environmentVariable.

LogOptionsLogOptions

Field

Description

disabled

boolean

Is logging from function disabled.

logGroupId

string

Entry should be written to log group resolved by ID.

Includes only one of the fields logGroupId, folderId.

Log entries destination.

folderId

string

Entry should be written to default log group for specified folder.

Includes only one of the fields logGroupId, folderId.

Log entries destination.

minLevel

enum (Level)

Minimum log entry level.

See LogLevel.Level for details.

  • LEVEL_UNSPECIFIED: Default log level.

    Equivalent to not specifying log level at all.

  • TRACE: Trace log level.

    Possible use case: verbose logging of some business logic.

  • DEBUG: Debug log level.

    Possible use case: debugging special cases in application logic.

  • INFO: Info log level.

    Mostly used for information messages.

  • WARN: Warn log level.

    May be used to alert about significant events.

  • ERROR: Error log level.

    May be used to alert about errors in infrastructure, logic, etc.

  • FATAL: Fatal log level.

    May be used to alert about unrecoverable failures and events.

StorageMountStorageMount

Field

Description

bucketId

string

Required field. S3 bucket name for mounting.

prefix

string

S3 bucket prefix for mounting.

mountPointName

string

Required field. Mount point directory name (not path) for mounting.

readOnly

boolean

Is mount read only.

AsyncInvocationConfigAsyncInvocationConfig

Field

Description

retriesCount

string (int64)

Number of retries of version invocation

successTarget

ResponseTarget

Required field. Target for successful result of the version's invocation

failureTarget

ResponseTarget

Required field. Target for unsuccessful result, if all retries failed

serviceAccountId

string

Service account which can invoke version

ResponseTargetResponseTarget

Target to which a result of an invocation will be sent

Field

Description

emptyTarget

object

Target to ignore a result

Includes only one of the fields emptyTarget, ymqTarget.

ymqTarget

YMQTarget

Target to send a result to ymq

Includes only one of the fields emptyTarget, ymqTarget.

YMQTargetYMQTarget

Field

Description

queueArn

string

Required field. Queue ARN

serviceAccountId

string

Required field. Service account which has write permission on the queue.

MountMount

Mount contains an information about version's external storage mount

Field

Description

name

string

Required field. Unique mount point name. Device will be mounted into /function/storage/

mode

enum (Mode)

Mount's mode

  • MODE_UNSPECIFIED
  • READ_ONLY
  • READ_WRITE

objectStorage

ObjectStorage

Object storage mounts

Includes only one of the fields objectStorage, ephemeralDiskSpec.

Target mount option

ephemeralDiskSpec

DiskSpec

Working disk (worker-local non-shared read-write NBS disk templates)

Includes only one of the fields objectStorage, ephemeralDiskSpec.

Target mount option

ObjectStorageObjectStorage

ObjectStorage as a mount

Field

Description

bucketId

string

Required field. ObjectStorage bucket name for mounting.

prefix

string

ObjectStorage bucket prefix for mounting.

DiskSpecDiskSpec

Disk as a mount

Field

Description

size

string (int64)

The size of disk for mount in bytes

blockSize

string (int64)

Optional block size of disk for mount in bytes

MetadataOptionsMetadataOptions

Field

Description

gceHttpEndpoint

enum (MetadataOption)

Enabled access to GCE flavored metadata

  • METADATA_OPTION_UNSPECIFIED: Option is default
  • ENABLED: Option is enabled
  • DISABLED: Option is disabled

awsV1HttpEndpoint

enum (MetadataOption)

Enabled access to AWS flavored metadata (IMDSv1)

  • METADATA_OPTION_UNSPECIFIED: Option is default
  • ENABLED: Option is enabled
  • DISABLED: Option is disabled

Была ли статья полезна?

Предыдущая
ListTagHistory
Следующая
ListRuntimes
Проект Яндекса
© 2025 ООО «Яндекс.Облако»