Google Cloud Functions (version v1.*.*)

A Google Cloud Functions integration

call_function

Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

Request for the CallFunction method.

Type: object

{
  "data" : "Required. Input to be passed to the function."
}

create_function

Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS error.

Parameters

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

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

Type: object

{
  "buildWorkerPool" : "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-@gcf-admin-robot.iam.gserviceaccount.com) must be granted the role Cloud Build Custom Workers Builder (roles/cloudbuild.customworkers.builder) in the project.",
  "eventTrigger" : {
    "resource" : "Required. The resource(s) from which to observe events, for example, `projects/_/buckets/myBucket`. Not all syntactically correct values are accepted by all services. For example: 1. The authorization model must support it. Google Cloud Functions only allows EventTriggers to be deployed that observe resources in the same project as the `CloudFunction`. 2. The resource type must match the pattern expected for an `event_type`. For example, an `EventTrigger` that has an `event_type` of \"google.pubsub.topic.publish\" should have a resource that matches Google Cloud Pub/Sub topics. Additionally, some services may support short names when creating an `EventTrigger`. These will always be returned in the normalized \"long\" format. See each *service's* documentation for supported formats.",
    "service" : "The hostname of the service that should be observed. If no string is provided, the default service implementing the API will be used. For example, `storage.googleapis.com` is the default for all event types in the `google.storage` namespace.",
    "eventType" : "Required. The type of event to observe. For example: `providers/cloud.storage/eventTypes/object.change` and `providers/cloud.pubsub/eventTypes/topic.publish`. Event types match pattern `providers/*/eventTypes/*.*`. The pattern contains: 1. namespace: For example, `cloud.storage` and `google.firebase.analytics`. 2. resource type: The type of resource on which event occurs. For example, the Google Cloud Storage API includes the type `object`. 3. action: The action that generates the event. For example, action for a Google Cloud Storage Object is 'change'. These parts are lower case.",
    "failurePolicy" : {
      "retry" : { }
    }
  },
  "description" : "User-provided description of a function.",
  "sourceToken" : "Input only. An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.",
  "ingressSettings" : "The ingress settings for the function, controlling what traffic can reach it.",
  "timeout" : "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.",
  "network" : "The VPC Network that this cloud function can connect to. It can be either the fully-qualified URI, or the short name of the network resource. If the short network name is used, the network must belong to the same project. Otherwise, it must belong to a project within the same organization. The format of this field is either `projects/{project}/global/networks/{network}` or `{network}`, where {project} is a project id where the network is defined, and {network} is the short name of the network. This field is mutually exclusive with `vpc_connector` and will be replaced by it. See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for more information on connecting Cloud projects.",
  "serviceAccountEmail" : "The email of the function's service account. If empty, defaults to `{project_id}@appspot.gserviceaccount.com`.",
  "vpcConnectorEgressSettings" : "The egress settings for the connector, controlling what traffic is diverted through it.",
  "maxInstances" : "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](https://cloud.google.com/functions/docs/max-instances) Guide for more details.",
  "sourceRepository" : {
    "deployedUrl" : "Output only. The URL pointing to the hosted repository where the function were defined at the time of deployment. It always points to a specific commit in the format described above.",
    "url" : "The URL pointing to the hosted repository where the function is defined. There are supported Cloud Source Repository URLs in the following formats: To refer to a specific commit: `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` To refer to a moveable alias (branch): `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` In particular, to refer to HEAD use `master` moveable alias. To refer to a specific fixed alias (tag): `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` You may omit `paths/*` if you want to use the main directory."
  },
  "sourceUploadUrl" : "The Google Cloud Storage signed URL used for source uploading, generated by google.cloud.functions.v1.GenerateUploadUrl",
  "vpcConnector" : "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](https://cloud.google.com/compute/docs/vpc) for more information on connecting Cloud projects.",
  "runtime" : "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](/sdk/gcloud/reference/functions/deploy#--runtime).",
  "updateTime" : "Output only. The last update timestamp of a Cloud Function.",
  "buildId" : "Output only. The Cloud Build ID of the latest successful deployment of the function.",
  "availableMemoryMb" : "The amount of memory in MB available for a function. Defaults to 256MB.",
  "sourceArchiveUrl" : "The Google Cloud Storage URL, starting with gs://, pointing to the zip archive which contains the function.",
  "labels" : "Labels associated with this Cloud Function.",
  "versionId" : "Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.",
  "environmentVariables" : "Environment variables that shall be available during function execution.",
  "name" : "A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`",
  "httpsTrigger" : {
    "securityLevel" : "The security level for the function.",
    "url" : "Output only. The deployed url for the function."
  },
  "entryPoint" : "The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named \"function\". For Node.js this is name of a function exported by the module specified in `source_location`.",
  "status" : "Output only. Status of the function deployment.",
  "buildEnvironmentVariables" : "Build environment variables that shall be available during build time."
}

delete_function

Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

generate_function_download_url

Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

Request of GenerateDownloadUrl method.

Type: object

{
  "versionId" : "The optional version of function. If not set, default, current version is used."
}

generate_function_upload_url

Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * content-type: application/zip * x-goog-content-length-range: 0,104857600 And this header SHOULD NOT be specified: * Authorization: Bearer YOUR_TOKEN

Parameters

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

Request of GenerateSourceUploadUrl method.

Type: object

{ }

get_function

Returns a function with the given name from the requested project.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

get_function_iam_policy

Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

options.requestedPolicyVersion

Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the IAM documentation.

Type: integer

get_operation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters

operationsId (required)

Type: string

list_functions

Returns a list of functions that belong to the requested project.

Parameters

locationsId (required)

Type: string

projectsId (required)

Type: string

list_locations

Lists information about the supported locations for this service.

Parameters

projectsId (required)

Type: string

filter

A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in AIP-160.

Type: string

list_operations

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.

Parameters

filter

Required. A filter for matching the requested operations. The supported formats of filter are: To query for a specific function: project:,location:,function:* To query for all of the latest operations for a project: project:*,latest:true

Type: string

name

Must not be set.

Type: string

patch_function

Updates existing function.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

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

Type: object

{
  "buildWorkerPool" : "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-@gcf-admin-robot.iam.gserviceaccount.com) must be granted the role Cloud Build Custom Workers Builder (roles/cloudbuild.customworkers.builder) in the project.",
  "eventTrigger" : {
    "resource" : "Required. The resource(s) from which to observe events, for example, `projects/_/buckets/myBucket`. Not all syntactically correct values are accepted by all services. For example: 1. The authorization model must support it. Google Cloud Functions only allows EventTriggers to be deployed that observe resources in the same project as the `CloudFunction`. 2. The resource type must match the pattern expected for an `event_type`. For example, an `EventTrigger` that has an `event_type` of \"google.pubsub.topic.publish\" should have a resource that matches Google Cloud Pub/Sub topics. Additionally, some services may support short names when creating an `EventTrigger`. These will always be returned in the normalized \"long\" format. See each *service's* documentation for supported formats.",
    "service" : "The hostname of the service that should be observed. If no string is provided, the default service implementing the API will be used. For example, `storage.googleapis.com` is the default for all event types in the `google.storage` namespace.",
    "eventType" : "Required. The type of event to observe. For example: `providers/cloud.storage/eventTypes/object.change` and `providers/cloud.pubsub/eventTypes/topic.publish`. Event types match pattern `providers/*/eventTypes/*.*`. The pattern contains: 1. namespace: For example, `cloud.storage` and `google.firebase.analytics`. 2. resource type: The type of resource on which event occurs. For example, the Google Cloud Storage API includes the type `object`. 3. action: The action that generates the event. For example, action for a Google Cloud Storage Object is 'change'. These parts are lower case.",
    "failurePolicy" : {
      "retry" : { }
    }
  },
  "description" : "User-provided description of a function.",
  "sourceToken" : "Input only. An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.",
  "ingressSettings" : "The ingress settings for the function, controlling what traffic can reach it.",
  "timeout" : "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.",
  "network" : "The VPC Network that this cloud function can connect to. It can be either the fully-qualified URI, or the short name of the network resource. If the short network name is used, the network must belong to the same project. Otherwise, it must belong to a project within the same organization. The format of this field is either `projects/{project}/global/networks/{network}` or `{network}`, where {project} is a project id where the network is defined, and {network} is the short name of the network. This field is mutually exclusive with `vpc_connector` and will be replaced by it. See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for more information on connecting Cloud projects.",
  "serviceAccountEmail" : "The email of the function's service account. If empty, defaults to `{project_id}@appspot.gserviceaccount.com`.",
  "vpcConnectorEgressSettings" : "The egress settings for the connector, controlling what traffic is diverted through it.",
  "maxInstances" : "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](https://cloud.google.com/functions/docs/max-instances) Guide for more details.",
  "sourceRepository" : {
    "deployedUrl" : "Output only. The URL pointing to the hosted repository where the function were defined at the time of deployment. It always points to a specific commit in the format described above.",
    "url" : "The URL pointing to the hosted repository where the function is defined. There are supported Cloud Source Repository URLs in the following formats: To refer to a specific commit: `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` To refer to a moveable alias (branch): `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` In particular, to refer to HEAD use `master` moveable alias. To refer to a specific fixed alias (tag): `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` You may omit `paths/*` if you want to use the main directory."
  },
  "sourceUploadUrl" : "The Google Cloud Storage signed URL used for source uploading, generated by google.cloud.functions.v1.GenerateUploadUrl",
  "vpcConnector" : "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](https://cloud.google.com/compute/docs/vpc) for more information on connecting Cloud projects.",
  "runtime" : "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](/sdk/gcloud/reference/functions/deploy#--runtime).",
  "updateTime" : "Output only. The last update timestamp of a Cloud Function.",
  "buildId" : "Output only. The Cloud Build ID of the latest successful deployment of the function.",
  "availableMemoryMb" : "The amount of memory in MB available for a function. Defaults to 256MB.",
  "sourceArchiveUrl" : "The Google Cloud Storage URL, starting with gs://, pointing to the zip archive which contains the function.",
  "labels" : "Labels associated with this Cloud Function.",
  "versionId" : "Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.",
  "environmentVariables" : "Environment variables that shall be available during function execution.",
  "name" : "A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`",
  "httpsTrigger" : {
    "securityLevel" : "The security level for the function.",
    "url" : "Output only. The deployed url for the function."
  },
  "entryPoint" : "The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named \"function\". For Node.js this is name of a function exported by the module specified in `source_location`.",
  "status" : "Output only. Status of the function deployment.",
  "buildEnvironmentVariables" : "Build environment variables that shall be available during build time."
}

updateMask

Required list of fields to be updated in this request.

Type: string

set_function_iam_policy

Sets the IAM access control policy on the specified function. Replaces any existing policy.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

Request message for SetIamPolicy method.

Type: object

{
  "updateMask" : "OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: \"bindings, etag\"`",
  "policy" : {
    "bindings" : [ {
      "condition" : {
        "expression" : "Textual representation of an expression in Common Expression Language syntax.",
        "description" : "Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.",
        "location" : "Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.",
        "title" : "Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression."
      },
      "role" : "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.",
      "members" : [ "string" ]
    } ],
    "etag" : "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.",
    "version" : "Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).",
    "auditConfigs" : [ {
      "auditLogConfigs" : [ {
        "logType" : "The log type that this config enables.",
        "exemptedMembers" : [ "string" ]
      } ],
      "service" : "Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services."
    } ]
  }
}

test_function_iam_permissions

Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Parameters

functionsId (required)

Type: string

locationsId (required)

Type: string

projectsId (required)

Type: string

$body

Request message for TestIamPermissions method.

Type: object

{
  "permissions" : [ "string" ]
}