Google Cloud Functions

Google Cloud Functions is an event-driven serverless compute platform that enables you to run your code locally or in the cloud without having to provision servers. This integration was integrated and tested with API version 1 of Google Cloud Functions

Configure Google Cloud Functions on Demisto

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for Google Cloud Functions.
  3. Click Add instance to create and configure a new integration instance.
ParameterDescriptionRequired
credentials_jsonService account private key file contents (JSON)True
project_idDefault project IDFalse
regionDefault regionFalse
proxyUse system proxy settingsFalse
insecureTrust any certificate (not secure)False
  1. Click Test to validate the URLs, token, and connection.

Commands

You can execute these commands from the Demisto CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

google-cloud-functions-list


Lists all Google Cloud functions.

Base Command

google-cloud-functions-list

Input
Argument NameDescriptionRequired
project_idThe project ID the Google Cloud function is in. Default is the instance's project.Optional
regionThe region of the Google Cloud function. Default is all regions. You can get a full list of regions using the google-cloud-function-regions-list command.Optional
Context Output
PathTypeDescription
GoogleCloudFunctions.Function.nameStringA user-defined name of the Google Cloud function.
GoogleCloudFunctions.Function.statusStringStatus of the Google Cloud function deployment. The status can be: ACTIVE, OFFLINE, DEPLOY_IN_PROGRESS, DELETE_IN_PROGRESS, UNKNOWN.
GoogleCloudFunctions.Function.labelsStringLabels associated with this Google Cloud function.
GoogleCloudFunctions.Function.runtimeStringThe time in which to run the Google Cloud function.
Command Example

!google-cloud-functions-list

Context Example
{
"GoogleCloudFunctions": {
"Function": [
{
"availableMemoryMb": 128,
"entryPoint": "hello_world",
"httpsTrigger": {
"url": "www.example.com"
},
"ingressSettings": "ALLOW_ALL",
"labels": {
"deployment-tool": "console-cloud"
},
"name": "projects/project/locations/us-central1/functions/demisto-func",
"runtime": "python37",
"serviceAccountEmail": "email",
"sourceUploadUrl": "",
"status": "ACTIVE",
"timeout": "60s",
"updateTime": "2020-04-05T12:43:29.610Z",
"versionId": "1"
}
]
}
}
Human Readable Output

Functions in project "gcp-integrations" and region "us-central1"

namehttpsTriggerstatusentryPointtimeoutavailableMemoryMbserviceAccountEmailupdateTimeversionIdlabelssourceUploadUrlruntimeingressSettings
projects/project/locations/us-central1/functions/demisto-funcurl: www.example.comACTIVEhello_world60s128email2020-04-05T12:43:29.610Z1deployment-tool: console-cloudpython37ALLOW_ALL

google-cloud-function-regions-list


Lists all regions in the project.

Base Command

google-cloud-function-regions-list

Input
Argument NameDescriptionRequired
project_idThe project ID the Google Cloud function is in. Default is the instance's project.Optional
Context Output
PathTypeDescription
GoogleCloudFunctions.Region.locationIdStringThe location ID of the region.
GoogleCloudFunctions.Region.nameStringThe full name of the region.
GoogleCloudFunctions.Region.labelsStringThe labels for the region.
Command Example

!google-cloud-function-regions-list

Context Example
{
"GoogleCloudFunctions": {
"Region": [
{
"labels": {
"cloud.googleapis.com/region": "europe-west1"
},
"locationId": "europe-west1",
"name": "projects/gcp-integrations/locations/europe-west1"
},
{
"labels": {
"cloud.googleapis.com/region": "europe-west3"
},
"locationId": "europe-west3",
"name": "projects/gcp-integrations/locations/europe-west3"
},
{
"labels": {
"cloud.googleapis.com/region": "europe-west2"
},
"locationId": "europe-west2",
"name": "projects/gcp-integrations/locations/europe-west2"
},
{
"labels": {
"cloud.googleapis.com/region": "us-central1"
},
"locationId": "us-central1",
"name": "projects/gcp-integrations/locations/us-central1"
},
{
"labels": {
"cloud.googleapis.com/region": "us-east1"
},
"locationId": "us-east1",
"name": "projects/gcp-integrations/locations/us-east1"
},
{
"labels": {
"cloud.googleapis.com/region": "us-east4"
},
"locationId": "us-east4",
"name": "projects/gcp-integrations/locations/us-east4"
},
{
"labels": {
"cloud.googleapis.com/region": "asia-northeast1"
},
"locationId": "asia-northeast1",
"name": "projects/gcp-integrations/locations/asia-northeast1"
},
{
"labels": {
"cloud.googleapis.com/region": "asia-east2"
},
"locationId": "asia-east2",
"name": "projects/gcp-integrations/locations/asia-east2"
}
]
}
}
Human Readable Output

Regions in project "gcp-integrations"

locationIdnamelabels
europe-west1projects/gcp-integrations/locations/europe-west1cloud.googleapis.com/region: europe-west1
europe-west3projects/gcp-integrations/locations/europe-west3cloud.googleapis.com/region: europe-west3
europe-west2projects/gcp-integrations/locations/europe-west2cloud.googleapis.com/region: europe-west2
us-central1projects/gcp-integrations/locations/us-central1cloud.googleapis.com/region: us-central1
us-east1projects/gcp-integrations/locations/us-east1cloud.googleapis.com/region: us-east1
us-east4projects/gcp-integrations/locations/us-east4cloud.googleapis.com/region: us-east4
asia-northeast1projects/gcp-integrations/locations/asia-northeast1cloud.googleapis.com/region: asia-northeast1
asia-east2projects/gcp-integrations/locations/asia-east2cloud.googleapis.com/region: asia-east2

google-cloud-function-get-by-name


Gets the details of a specific Google Cloud function.

Base Command

google-cloud-function-get-by-name

Input
Argument NameDescriptionRequired
project_idThe project ID the Google Cloud function is in. Default is the instance's project.Optional
regionThe region of the Google Cloud function. You can get a full list of regions using the google-cloud-function-regions-list command. Default is all regions.Optional
function_nameThe name of the function.Required
Context Output
PathTypeDescription
GoogleCloudFunctions.Function.nameStringA user-defined name of the Google Cloud function.
GoogleCloudFunctions.Function.statusStringStatus of the Google Cloud function deployment. The status can be ACTIVE, OFFLINE, DEPLOY_IN_PROGRESS, DELETE_IN_PROGRESS, UNKNOWN.
GoogleCloudFunctions.Function.labelsStringThe labels associated with this Google Cloud Function.
GoogleCloudFunctions.Function.runtimeStringThe time in which to run the Google Cloud function.
Command Example

!google-cloud-function-get-by-name function_name="demisto-func"

Context Example
{
"GoogleCloudFunctions": {
"Function": {
"availableMemoryMb": 128,
"entryPoint": "hello_world",
"httpsTrigger": {
"url": ""
},
"ingressSettings": "ALLOW_ALL",
"labels": {
"deployment-tool": "console-cloud"
},
"name": "projects/project/locations/us-central1/functions/demisto-func",
"runtime": "python37",
"serviceAccountEmail": "email",
"sourceUploadUrl": "",
"status": "ACTIVE",
"timeout": "60s",
"updateTime": "2020-04-05T12:43:29.610Z",
"versionId": "1"
}
}
}
Human Readable Output

Here are the details for demisto-func:

namehttpsTriggerstatusentryPointtimeoutavailableMemoryMbserviceAccountEmailupdateTimeversionIdlabelssourceUploadUrlruntimeingressSettings
projects/project/locations/us-central1/functions/demisto-funcurl: www.example.comACTIVEhello_world60s128email2020-04-05T12:43:29.610Z1deployment-tool: console-cloudpython37ALLOW_ALL

google-cloud-function-execute


Executes a Google Cloud function.

Base Command

google-cloud-function-execute

Input
Argument NameDescriptionRequired
function_nameThe name of the Google Cloud function to execute.Required
regionThe region of the Google Cloud function. Default is all regions. You can get a full list of regions using the google-cloud-function-regions-list command.Optional
parametersThe Google Cloud function parameters in a key:value format. Multiple parameters should be comma-separated (i.e., key1:value1,key2:value2).Optional
Context Output
PathTypeDescription
GoogleCloudFunctions.Execution.executionIdStringExecution ID of the Google Cloud function invocated.
GoogleCloudFunctions.Execution.resultStringResult populated for successful execution of a synchronous Google Cloud function. It will not be populated if the Google Cloud function does not return a result through context.
GoogleCloudFunctions.Execution.errorStringEither a system or user-function generated error. Set if the execution was not successful.
Command Example

!google-cloud-function-execute function_name=demisto-func parameters=message:hell\"oThere

Context Example
{
"GoogleCloudFunctions": {
"Execution": {
"executionId": "xp9hifb4y996",
"result": "hell\"oThere"
}
}
}
Human Readable Output

Execution details for demisto-func:

executionIdresult
xp9hifb4y996hell"oThere