GCP
Manage and secure Google Cloud Platform resources. On Cortex Platform, authentication is handled automatically via the cloud connector. For Cortex XSOAR and Cortex XSIAM (version < 3.0), configure a GCP Service Account private key JSON and a default GCP Project ID.
Cloud Services · GCP
Details
| ID | GCP |
|---|---|
| Provider | |
| Category | Cloud Services |
| From Version | 8.11.0 |
| Docker Image | demisto/googleapi-python3:1.0.0.10182333 |
| Supported Modules | Cloud Posture Security Cortex Cloud Cloud Runtime Security Agentix XSIAM |
README
The GCP Integration automates management and security configurations for Compute Engine, Storage, and Container resources on GCP.
This integration was integrated and tested with version v1 (Compute, Storage, Container, SERVICE_USAGE), v3 (Resource Manager).
Configure Google Cloud Platform in Cortex
| Parameter | Description | Required |
|---|---|---|
| Service Account Private Key (JSON) | The full content of a GCP Service Account private key JSON file. In the Google Cloud Console, go to IAM & Admin > Service Accounts and create a service account with the required roles. Then under the Keys tab, create a JSON key. Paste the downloaded JSON contents here. | True |
| GCP Project ID | The GCP project ID to authenticate against when testing the integration (e.g. my-project-123). If left empty, the project ID from the Service Account private key JSON is used. | False |
| Use system proxy settings | False | |
| Trust any certificate (not secure) | False |
Commands
You can execute these commands from the 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.
gcp-compute-firewall-patch
Updates a specific firewall rule with the data included in the request. Required permissions: compute.firewalls.update, compute.firewalls.get, compute.firewalls.list, compute.networks.updatePolicy, compute.networks.list.
Base Command
gcp-compute-firewall-patch
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Name of the firewall rule to update. | Required |
| description | An optional description of this resource, which you provide when you create the resource. | Optional |
| network | URL of the network resource for this firewall rule. If not specified when creating a firewall rule, the default network is used. | Optional |
| priority | Priority for this rule. This is an integer between 0 and 65535, both inclusive. When not specified, the value assumed is 1000. Relative priorities determine precedence of conflicting rules. Lower value of priority implies higher precedence (eg, a rule with priority 0 has higher precedence than a rule with priority 1). DENY rules take precedence over ALLOW rules. | Optional |
| sourceRanges | If source ranges are specified, the firewall applies only to traffic with source IP addresses in these ranges. These ranges must be expressed in CIDR format. One or both of sourceRanges and sourceTags may be set. If both properties are set, the firewall applies to traffic with a source IP address within sourceRanges OR the source IP belonging to a tag listed in the sourceTags property. The connection does not need to match both properties for the firewall to apply. Only IPv4 is supported, comma-separated. | Optional |
| destinationRanges | If destination ranges are specified, the firewall applies only to traffic with destination IP addresses in these ranges. These ranges must be expressed in CIDR format. Only IPv4 is supported. Comma-separated. | Optional |
| sourceTags | If source tags are specified, the firewall rule applies only to traffic with source IPs that match the primary network interfaces of VM instances that have the tag and are in the same VPC network. Source tags cannot be used to control traffic to an instance’s external IP address. It only applies to traffic between instances in the same virtual network, because tags are associated with instances, not IP addresses. One or both of sourceRanges and sourceTags may be set. If both properties are set, the firewall will apply to traffic with a source IP address within sourceRanges OR the source IP belonging to a tag listed in the sourceTags property. The connection does not need to match both properties for the firewall to apply. Comma-separated. | Optional |
| targetTags | A list of tags that controls which instances the firewall rule applies to. If targetTags are specified, then the firewall rule applies only to instances in the VPC network that have one of those tags. If no targetTags are specified, the firewall rule applies to all instances on the specified network. Comma-separated. | Optional |
| sourceServiceAccounts | If source service accounts are specified, the firewall applies only to traffic originating from an instance with a service account in this list. Source service accounts cannot be used to control traffic to an instance’s external IP address because service accounts are associated with an instance, not an IP address. sourceRanges can be set at the same time as sourceServiceAccounts. If both are set, the firewall will apply to traffic that has a source IP address within sourceRanges OR the source IP belongs to an instance with a service account listed in sourceServiceAccount. The connection does not need to match both properties for the firewall to apply. sourceServiceAccounts cannot be used simultaneously as sourceTags or targetTags. Comma-separated. | Optional |
| targetServiceAccounts | A list of service accounts indicating sets of instances located in the network that may make network connections as specified in allowed[]. targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. If neither targetServiceAccounts nor targetTags are specified, the firewall rule applies to all instances on the specified network. Comma-separated. | Optional |
| allowed | The ALLOW rules list specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection. For example, ipprotocol=tcp,ports=22,443;ipprotocol=tcp,ports=8080,80. | Optional |
| denied | The DENY rules list specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a denied connection. For example, ipprotocol=tcp,ports=22,443;ipprotocol=tcp,ports=8080,80. | Optional |
| direction | Direction of traffic to which this firewall applies; default is INGRESS. Note: For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS traffic, it is NOT supported to specify sourceRanges OR sourceTags. | Optional |
| logConfigEnable | This field denotes whether to enable logging for a particular firewall rule. Possible values are: true, false. | Optional |
| disabled | Denotes whether the firewall rule is disabled, i.e not applied to the network it is associated with. When set to true, the firewall rule is not enforced and the network behaves as if it did not exist. If this is unspecified, the firewall rule will be enabled. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING, RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | The user who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time the operation was requested, in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-storage-bucket-policy-delete
Removes an entity from a bucket’s Access Control List. Required permissions: storage.buckets.getIamPolicy, storage.buckets.setIamPolicy.
Base Command
gcp-storage-bucket-policy-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Name of the GCS bucket. | Required |
| entity | Entity to remove from the Access Control List. Common entity formats are: user:<userId or email> group:<groupId or email> allUsers allAuthenticatedUsers For more options and details, see: https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls#resource . Default is allUsers. |
Optional |
Context Output
There is no context output for this command.
gcp-compute-subnet-update
Enables flow logs or Private Google Access on a subnet. Required permissions: compute.subnetworks.setPrivateIpGoogleAccess, compute.subnetworks.update, compute.subnetworks.get, compute.subnetworks.list.
Base Command
gcp-compute-subnet-update
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| region | GCP region. | Required |
| resource_name | Subnet name. | Required |
| enable_flow_logs | Enable VPC Flow Logs. Possible values are: true, false. | Optional |
| enable_private_ip_google_access | Enable Private Google Access. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.name | String | The name of the updated subnet. |
| GCP.Compute.Operations.region | String | The region of the updated subnet. |
| GCP.Compute.Operations.subnetName | String | The name of the subnet that was updated. |
| GCP.Compute.Operations.enableFlowLogs | Boolean | Whether flow logs are enabled for the subnet. |
| GCP.Compute.Operations.ipCidrRange | String | The updated CIDR range for the subnet. |
| GCP.Compute.Operations.privateIpGoogleAccess | Boolean | Whether private Google access is enabled for the subnet. |
| GCP.Compute.Operations.privateIpv6GoogleAccess | Boolean | Whether private IPv6 Google access is enabled for the subnet. |
| GCP.Compute.Operations.stackType | String | The stack type of the subnet (e.g., `IPV4`, `IPV6`). |
| GCP.Compute.Operations.rangeName | String | The name of the IP range associated with the subnet. |
| GCP.Compute.Operations.secondaryIpRanges | Unknown | List of secondary IP ranges for the subnet. |
| GCP.Compute.Operations.description | String | The description of the subnet. |
gcp-container-cluster-security-update
Configures security settings for GKE clusters, including access controls and visibility. Required permissions: container.clusters.update, container.clusters.get, container.clusters.list.
Base Command
gcp-container-cluster-security-update
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| region | GCP region. | Required |
| resource_name | Name of the GKE cluster. | Required |
| enable_intra_node_visibility | Enable intra-node visibility. Possible values are: true, false. | Optional |
| enable_master_authorized_networks | Enable Master Authorized Networks. Possible values are: true, false. | Optional |
| cidrs | Comma-separated list of up to 50 CIDR blocks (e.g., “192.168.0.0/24,10.0.0.0/32”) that are allowed to access the Kubernetes master via HTTPS. If enable_master_authorized_networks is true and no CIDRs are provided, all access will be blocked. . |
Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Container.Operations.name | String | The name of the GKE cluster. |
| GCP.Container.Operations.zone | String | The zone of the GKE cluster. |
| GCP.Container.Operations.enableStackdriverLogging | Boolean | Whether Stackdriver Logging is enabled for the cluster. |
| GCP.Container.Operations.enableStackdriverMonitoring | Boolean | Whether Stackdriver Monitoring is enabled for the cluster. |
| GCP.Container.Operations.enablePrivateNodes | Boolean | Whether private nodes are enabled for the GKE cluster. |
| GCP.Container.Operations.enablePrivateEndpoint | Boolean | Whether private endpoint is enabled for the GKE cluster control plane. |
| GCP.Container.Operations.enableHttpsOnly | Boolean | Whether HTTPS-only traffic is enforced for the cluster. |
| GCP.Container.Operations.enableNetworkPolicy | Boolean | Whether network policies are enabled for the cluster. |
| GCP.Container.Operations.enableAutoscaling | Boolean | Whether autoscaling is enabled for the cluster nodes. |
| GCP.Container.Operations.enableIstio | Boolean | Whether Istio is enabled for the GKE cluster. |
| GCP.Container.Operations.enablePodSecurityPolicy | Boolean | Whether PodSecurityPolicy is enabled for the GKE cluster. |
| GCP.Container.Operations.enableBinaryAuthorization | Boolean | Whether Binary Authorization is enabled for the cluster. |
| GCP.Container.Operations.enableLegacyABAC | Boolean | Whether legacy ABAC is enabled for the cluster. |
| GCP.Container.Operations.clusterIpv4Cidr | String | The cluster’s IPv4 CIDR block. |
| GCP.Container.Operations.masterAuthorizedNetworksConfig.cidrBlocks | Unknown | List of authorized CIDR blocks that can access the GKE cluster master. |
| GCP.Container.Operations.masterAuthorizedNetworksConfig.enabled | Boolean | Whether master authorized networks are enabled for the cluster. |
| GCP.Container.Operations.network | String | The network to which the GKE cluster belongs. |
| GCP.Container.Operations.subnetwork | String | The subnetwork to which the GKE cluster belongs. |
| GCP.Container.Operations.loggingService | String | The logging service used for the cluster (e.g., “logging.googleapis.com”). |
| GCP.Container.Operations.monitoringService | String | The monitoring service used for the cluster (e.g., “monitoring.googleapis.com”). |
| GCP.Container.Operations.nodePools | Unknown | A list of node pools in the cluster, with their configuration and security settings. |
| GCP.Container.Operations.privateClusterConfig.enablePrivateNodes | Boolean | Whether private nodes are enabled in the cluster. |
| GCP.Container.Operations.privateClusterConfig.enablePrivateEndpoint | Boolean | Whether private endpoint is enabled for the cluster control plane. |
| GCP.Container.Operations.masterVersion | String | The current version of the Kubernetes master in the GKE cluster. |
gcp-storage-bucket-metadata-update
Updates Google Cloud Storage (GCS) bucket metadata, including settings such as versioning and Uniform Bucket-Level Access (UBLA). Required permission: storage.buckets.update.
Base Command
gcp-storage-bucket-metadata-update
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Name of the bucket. | Required |
| enable_versioning | Enable versioning. Possible values are: true, false. | Optional |
| enable_uniform_access | Enable uniform bucket-level access. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.StorageBucket.Metadata | Unknown | Updated bucket metadata. |
| GCP.StorageBucket.Metadata.name | String | The name of the GCP bucket. |
| GCP.StorageBucket.Metadata.id | String | The ID of the GCP bucket. |
| GCP.StorageBucket.Metadata.location | String | The location of the bucket. |
| GCP.StorageBucket.Metadata.storageClass | String | The storage class of the bucket (e.g., STANDARD, NEARLINE). |
| GCP.StorageBucket.Metadata.created | Date | The creation timestamp of the bucket. |
| GCP.StorageBucket.Metadata.updated | Date | The last update timestamp of the bucket. |
| GCP.StorageBucket.Metadata.metageneration | Number | The metadata generation of the bucket. |
| GCP.StorageBucket.Metadata.labels | Unknown | The labels attached to the bucket. |
| GCP.StorageBucket.Metadata.defaultEventBasedHold | Boolean | Whether a default event-based hold is enabled on the bucket. |
| GCP.StorageBucket.Metadata.retentionPolicy.retentionPeriod | Number | The duration in seconds that objects in the bucket must be retained. |
| GCP.StorageBucket.Metadata.retentionPolicy.effectiveTime | Date | The time from which the retention policy is effective. |
| GCP.StorageBucket.Metadata.retentionPolicy.isLocked | Boolean | Whether the retention policy is locked. |
| GCP.StorageBucket.Metadata.versioning.enabled | Boolean | Whether object versioning is enabled. |
| GCP.StorageBucket.Metadata.logging.logBucket | String | The destination bucket where access logs are stored. |
| GCP.StorageBucket.Metadata.logging.logObjectPrefix | String | The object prefix used for logging. |
| GCP.StorageBucket.Metadata.lifecycle.rule | Unknown | A list of lifecycle management rules for the bucket. |
| GCP.StorageBucket.Metadata.iamConfiguration.uniformBucketLevelAccess | Boolean | Whether uniform bucket-level access is enabled. |
| GCP.StorageBucket.Metadata.cors | Unknown | CORS configuration for the bucket. |
| GCP.StorageBucket.Metadata.customPlacementConfig | Unknown | Custom placement configuration for multi-region buckets. |
| GCP.StorageBucket.Metadata.encryption.defaultKmsKeyName | String | The default Cloud KMS key used to encrypt objects. |
| GCP.StorageBucket.Metadata.billing.requesterPays | Boolean | Whether requester pays is enabled. |
| GCP.StorageBucket.Metadata.website.mainPageSuffix | String | Suffix appended to requests for the bucket’s website configuration. |
| GCP.StorageBucket.Metadata.website.notFoundPage | String | The path to the custom 404 page for the bucket website. |
gcp-iam-project-policy-binding-remove
Removes a specified IAM role binding from a GCP project. Required permissions: resourcemanager.projects.getIamPolicy, resourcemanager.projects.setIamPolicy.
Base Command
gcp-iam-project-policy-binding-remove
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| member | Member to remove (e.g., user:test@example.com). | Required |
| role | Role to remove (e.g., roles/viewer). | Required |
Context Output
There is no context output for this command.
gcp-compute-instance-service-account-set
Sets the service account for a GCP Compute Engine VM instance. The instance must be stopped before the service account can be changed. Required permissions: compute.instances.setServiceAccount, compute.instances.get.
Base Command
gcp-compute-instance-service-account-set
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| resource_name | Name of the VM instance. | Required |
| service_account_email | Email of the service account. | Required |
| scopes | OAuth scopes to assign (full URLs), e.g., https://www.googleapis.com/auth/cloud-platform. Empty list means no scopes. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING, RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | The user who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time the operation was requested, in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-instance-service-account-remove
Removes the service account associated with a GCP Compute Engine VM instance. The instance must be stopped before the service account can be changed. Required permissions: compute.instances.setServiceAccount, compute.instances.get.
Base Command
gcp-compute-instance-service-account-remove
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| resource_name | Name of the VM instance. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING, RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | The user who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time that this operation was requested. This value is in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-instance-start
Starts an instance that was stopped using the instances().stop method. Required permission: compute.instances.start.
Base Command
gcp-compute-instance-start
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| resource_name | Name of the instance resource to start. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | The user who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time that this operation was requested. This value is in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-instance-stop
Stops and cleanly shuts down a running instance, allowing you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using such as persistent disks and static IP addresses will continue to be charged until they are deleted. Required permission: compute.instances.stop.
Base Command
gcp-compute-instance-stop
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| resource_name | Name of the instance resource to stop. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | The user who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time that this operation was requested. This value is in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not configurable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-instances-list
Retrieves the list of instances in the specified zone. Required permission: compute.instances.list.
Base Command
gcp-compute-instances-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| filters | A filter expression for resources listed in the response. The expression must specify a field name, a comparison operator (=, !=, >, or <), and a value, which can be a string, number, or boolean. For example, to exclude a Compute Engine instance named example-instance, use name != example-instance. | Optional |
| limit | The maximum number of results per page that should be returned. Acceptable values are 0 to 500, inclusive. Default is 50. | Optional |
| order_by | Sorts list results in a specific order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using order_by=”creationTimestamp desc”. | Optional |
| page_token | Specifies a page token. Set page_token to the nextPageToken returned by a previous list request to get the next page of results. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Instances.kind | String | Type of the resource.Always compute#instance for instances. |
| GCP.Compute.Instances.id | String | The unique identifier of the resource. |
| GCP.Compute.Instances.creationTimestamp | String | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Instances.name | String | The name of the resource, provided by the client when the resource is first created. |
| GCP.Compute.Instances.description | String | An optional description for this resource. |
| GCP.Compute.Instances.tags | String | Tags to apply to this instance. |
| GCP.Compute.Instances.machineType | String | Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/machine-type. |
| GCP.Compute.Instances.status | String | The status of the instance. |
| GCP.Compute.Instances.statusMessage | String | An optional, human-readable explanation of the status. |
| GCP.Compute.Instances.zone | String | URL of the zone where the instance resides. |
| GCP.Compute.Instances.canIpForward | String | Allows this instance to send and receive packets with non-matching destination or source IPs. |
| GCP.Compute.Instances.networkInterfaces | Object | An array of network configurations for the instance. |
| GCP.Compute.Instances.disks | Object | Array of disks associated with the instance. |
| GCP.Compute.Instances.metadata | Object | The metadata key/value pairs assigned to the instance. |
| GCP.Compute.Instances.serviceAccounts | Object | A list of service accounts, with their specified scopes, authorized for the instance. |
| GCP.Compute.Instances.selfLink | String | Server-defined URL for the resource. |
| GCP.Compute.Instances.scheduling | Object | Sets the scheduling options for the instance. |
| GCP.Compute.Instances.cpuPlatform | String | The CPU platform used by the instance. |
| GCP.Compute.Instances.labels | String | Labels to apply to the instance. |
| GCP.Compute.Instances.labelFingerprint | String | A fingerprint for this request, which is essentially a hash of the label’s contents and used for optimistic locking. |
| GCP.Compute.Instances.instanceEncryptionKey | Object | Encrypts suspended data for an instance with a customer-managed encryption key. |
| GCP.Compute.Instances.minCpuPlatform | String | Specifies a minimum CPU platform for the VM instance. |
| GCP.Compute.Instances.guestAccelerators | Object | A list of the type and count of accelerator cards attached to the instance. |
| GCP.Compute.Instances.startRestricted | Boolean | Indicates whether a VM has been restricted from starting because Compute Engine detected suspicious activity. |
| GCP.Compute.Instances.deletionProtection | Boolean | Whether the resource should be protected against deletion. |
| GCP.Compute.Instances.resourcePolicies | String | Resource policies applied to this instance. |
| GCP.Compute.Instances.sourceMachineImage | String | Source machine image. |
| GCP.Compute.Instances.reservationAffinity | Object | Specifies the reservations that the instance can consume from. |
| GCP.Compute.Instances.hostname | String | Specifies the hostname of the instance. |
| GCP.Compute.Instances.displayDevice | Object | Enables display device for the instance. |
| GCP.Compute.Instances.shieldedInstanceConfig | Object | Shielded VM configuration for the instance. |
| GCP.Compute.Instances.sourceMachineImageEncryptionKey | Object | The source machine image encryption key used when creating an instance from a machine image. |
| GCP.Compute.Instances.confidentialInstanceConfig | Object | Confidential computing configuration for the instance. |
| GCP.Compute.Instances.fingerprint | String | Specifies a fingerprint for this resource, which is essentially a hash of the instance’s contents and used for optimistic locking. |
| GCP.Compute.Instances.privateIpv6GoogleAccess | String | The private IPv6 Google access type for the VM. |
| GCP.Compute.Instances.advancedMachineFeatures | Object | Controls for advanced machine-related behavior features. |
| GCP.Compute.Instances.lastStartTimestamp | String | Last start timestamp in RFC3339 text format. |
| GCP.Compute.Instances.lastStopTimestamp | String | Last stop timestamp in RFC3339 text format. |
| GCP.Compute.Instances.lastSuspendedTimestamp | String | Last suspended timestamp in RFC3339 text format. |
| GCP.Compute.Instances.satisfiesPzs | String | Indicates whether the instance satisfies physical zone separation requirements. |
| GCP.Compute.Instances.satisfiesPzi | String | Indicates whether the instance satisfies physical zone isolation requirements. |
| GCP.Compute.Instances.resourceStatus | Object | The resource status. |
| GCP.Compute.Instances.networkPerformanceConfig | Object | Network performance configuration. |
| GCP.Compute.Instances.keyRevocationActionType | String | KeyRevocationActionType of the instance. |
| GCP.Compute.InstancesNextPageToken | String | The token used to retrieve the next page of results for list requests. |
| GCP.Compute.InstancesSelfLink | String | Server-defined URL for the resource. |
| GCP.Compute.InstancesWarning | Object | Informational warning message. |
gcp-compute-instance-labels-set
Sets labels on an instance. Required permission: compute.instances.setLabels.
Base Command
gcp-compute-instance-labels-set
Input
| Argument Name | Description | Required |
|---|---|---|
| instance | Name of the instance resource to return. | Required |
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| labels | An object containing a list of “key”: value pairs, without spaces. Example: key=abc,value=123;key=ABC,value=321. | Required |
| label_fingerprint | Fingerprint of the previous set of labels for this resource, used to prevent conflicts. Provide the latest fingerprint value when making a request to add or change labels. | Required |
| add_labels | Whether to add the new labels to the existing ones or override the previous labels with the news. True - add, False - override. Possible values are: true, false. Default is false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For snapshot-creation operations, this points to the persistent disk from which the snapshot was created. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING, RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | User who requested the operation, for example, EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator ranging from 0 to 100. It does not need to be linear or support any specific granularity of operations. This indicator should not be used to estimate completion time. The value should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time the operation was requested, in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that the operation was started by the server, in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that the operation was completed, in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-instance-get
Returns a specific instance resource. To get a list of available instances, make a list() request. Required permission: compute.instances.get.
Base Command
gcp-compute-instance-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone for this request. | Required |
| instance | Name of the instance resource to return. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Instances.id | string | The unique identifier for the resource, defined by the server. |
| GCP.Compute.Instances.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Instances.name | string | The name of the resource, provided by the client when first creating it. The name must be 1–63 characters long and comply with RFC1035. It must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?, meaning the first character must be a lowercase letter, and all following characters can be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Instances.description | string | An optional description of this resource. Provide this property when you create the resource. |
| GCP.Compute.Instances.tags | string | Tags to apply to this instance. Tags identify valid sources or targets for network firewalls and are specified by the client during instance creation. Tags can later be modified using the setTags method. Each tag must comply with RFC1035. Multiple tags can be specified via the tags.items field. |
| GCP.Compute.Instances.tags.items | string | An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. |
| GCP.Compute.Instances.tags.fingerprint | string | Specifies a fingerprint for this request, which is essentially a hash of the tags contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update tags. You must always provide an up-to-date fingerprint hash in order to update or change tags. |
| GCP.Compute.Instances.machineType | string | Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/machine-type. This is provided by the client when the instance is created. |
| GCP.Compute.Instances.status | string | The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, STOPPED, SUSPENDING, SUSPENDED, and TERMINATED. |
| GCP.Compute.Instances.statusMessage | string | An optional, human-readable explanation of the status. |
| GCP.Compute.Instances.zone | string | URL of the zone where the instance resides. This field must be specified in the HTTP request URL and cannot be set in the request body. |
| GCP.Compute.Instances.canIpForward | boolean | Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. |
| GCP.Compute.Instances.networkInterfaces | string | An array of network configurations for this instance. These specify how interfaces are configured to interact with other network services, such as connecting to the internet. Multiple interfaces are supported per instance. |
| GCP.Compute.Instances.networkInterfaces.network | string | URL of the network resource for this instance. When creating an instance, if neither the network nor the subnetwork is specified, the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. |
| GCP.Compute.Instances.networkInterfaces.subnetwork | string | The URL of the Subnetwork resource for this instance. For legacy networks, do not provide this property. For auto subnet networks, specifying the subnetwork is optional. For custom subnet networks, this field must be specified. If provided, the subnetwork can be a full or partial URL. |
| GCP.Compute.Instances.networkInterfaces.networkIP | string | An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. |
| GCP.Compute.Instances.networkInterfaces.name | string | The name of the network interface, generated by the server. For network devices, these are eth0, eth1, etc. |
| GCP.Compute.Instances.networkInterfaces.accessConfigs | string | An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then the instance will have no external internet access. |
| GCP.Compute.Instances.networkInterfaces.aliasIpRanges | string | An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. |
| GCP.Compute.Instances.networkInterfaces.fingerprint | string | Fingerprint hash of the contents stored in this network interface. This field is ignored when inserting an instance or adding a network interface. To update the network interface, an up-to-date fingerprint must be provided; otherwise, the request fails with error 412 conditionNotMet. |
| GCP.Compute.Instances.networkInterfaces.kind | string | Type of the resource. Always compute#networkInterface for network interfaces. |
| GCP.Compute.Instances.disks | string | Array of disks associated with this instance. Persistent disks must be created before you can assign them. |
| GCP.Compute.Instances.disks.type | string | Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, the default is PERSISTENT. |
| GCP.Compute.Instances.disks.mode | string | The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode. |
| GCP.Compute.Instances.disks.source | string | Specifies a valid partial or full URL to an existing Persistent Disk resource. When creating a new instance, one of initializeParams.sourceImage or disks.source is required except for local SSD. |
| GCP.Compute.Instances.disks.deviceName | string | Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and other operations from within the instance. |
| GCP.Compute.Instances.disks.index | number | A zero-based index for this disk, where 0 is reserved for the boot disk. Each attached disk on an instance has a unique index number. |
| GCP.Compute.Instances.disks.boot | boolean | Indicates that this is a boot disk. The VM uses the first partition of the disk as its root filesystem. |
| GCP.Compute.Instances.disks.initializeParams | string | Specifies parameters for a new disk to be created with the instance. Use initialization parameters to create boot disks or local SSDs attached to the instance. |
| GCP.Compute.Instances.disks.autoDelete | boolean | Specifies whether the disk is auto-deleted when the instance is deleted (not when the disk is detached). |
| GCP.Compute.Instances.disks.licenses | string | Any valid publicly visible licenses. |
| GCP.Compute.Instances.disks.interface | string | Specifies the disk interface for attaching this disk, either SCSI or NVME. The default is SCSI. Persistent disks must use SCSI; attaching a persistent disk with any other interface will fail. Local SSDs can use either NVME or SCSI. For performance characteristics of SCSI versus NVMe, see Local SSD performance. |
| GCP.Compute.Instances.disks.guestOsFeatures | string | A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. |
| GCP.Compute.Instances.disks.diskEncryptionKey | Object | Encrypts or decrypts a disk using a customer-supplied encryption key. |
| GCP.Compute.Instances.disks.kind | string | Type of the resource. Always compute#attachedDisk for attached disks. |
| GCP.Compute.Instances.metadata | string | The metadata key/value pairs assigned to the instance. This includes custom metadata and predefined keys. |
| GCP.Compute.Instances.metadata.fingerprint | string | Specifies a fingerprint for this request, which is a hash of the metadata contents used for optimistic locking. The fingerprint is generated by Compute Engine and changes after every metadata update. You must provide an up-to-date fingerprint to modify metadata; otherwise, the request fails with error 412 conditionNotMet. |
| GCP.Compute.Instances.metadata.items | string | Array of key/value pairs. The total size of all keys and values must be less than 512 KB. |
| GCP.Compute.Instances.metadata.kind | string | Type of the resource. Always compute#metadata for metadata. |
| GCP.Compute.Instances.serviceAccounts | string | A list of service accounts, with their specified scopes, authorized for the instance. Only one service account per VM instance is supported. |
| GCP.Compute.Instances.serviceAccounts.email | string | Email address of the service account. |
| GCP.Compute.Instances.serviceAccounts.scopes | string | The list of scopes to be made available for this service account. |
| GCP.Compute.Instances.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Instances.scheduling | string | Sets the scheduling options for the instance. |
| GCP.Compute.Instances.scheduling.onHostMaintenance | string | Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible behavior is TERMINATE. For more information, see Setting Instance Scheduling Options. |
| GCP.Compute.Instances.scheduling.automaticRestart | boolean | Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). You can only set the automatic restart option for standard instances. Preemptible instances cannot be automatically restarted. |
| GCP.Compute.Instances.scheduling.preemptible | boolean | Defines whether the instance is preemptible. This can only be set during instance creation, it cannot be set or changed after the instance has been created. |
| GCP.Compute.Instances.scheduling.nodeAffinities | string | A set of node affinity and anti-affinity. |
| GCP.Compute.Instances.cpuPlatform | string | The CPU platform used by the instance. |
| GCP.Compute.Instances.labels | string | Labels to apply to the instance. These can be later modified by the setLabels method. |
| GCP.Compute.Instances.labels.key | string | The label key. |
| GCP.Compute.Instances.labels.value | string | The label value. |
| GCP.Compute.Instances.labelFingerprint | string | A fingerprint for this request, which is essentially a hash of the labels contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. |
| GCP.Compute.Instances.minCpuPlatform | string | Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: “Intel Haswell” or minCpuPlatform: “Intel Sandy Bridge”. |
| GCP.Compute.Instances.guestAccelerators | string | A list of the type and count of accelerator cards attached to the instance. |
| GCP.Compute.Instances.guestAccelerators.acceleratorType | string | Full or partial URL of the accelerator type resource to attach to this instance. For example: projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100. When creating an instance template, specify only the accelerator name. |
| GCP.Compute.Instances.guestAccelerators.acceleratorCount | string | The number of the guest accelerator cards exposed to the instance. |
| GCP.Compute.Instances.startRestricted | boolean | Indicates whether a VM has been restricted from starting because Compute Engine detected suspicious activity. |
| GCP.Compute.Instances.deletionProtection | boolean | Whether the resource should be protected against deletion. |
| GCP.Compute.Instances.hostname | string | Hostname. |
| GCP.Compute.Instances.kind | string | Type of the resource. Always compute#instance for instances. |
gcp-storage-bucket-list
Retrieves the list of buckets in the project associated with the client. Required permission: storage.buckets.list.
Base Command
gcp-storage-bucket-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| limit | Maximum number of buckets to return. | Optional |
| prefix | Filter results to buckets whose names begin with this prefix. | Optional |
| page_token | Token for pagination. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.Bucket.id | String | The unique identifier for the bucket. |
| GCP.Storage.Bucket.name | String | The name of the bucket. |
| GCP.Storage.Bucket.kind | String | The type of resource (for example, storage#bucket). |
| GCP.Storage.Bucket.location | String | The location of the bucket. |
| GCP.Storage.Bucket.locationType | String | The type of location (for example, multi-region). |
| GCP.Storage.Bucket.projectNumber | String | The GCP project number associated with the bucket. |
| GCP.Storage.Bucket.storageClass | String | The storage class of the bucket. |
| GCP.Storage.Bucket.rpo | String | The recovery point objective setting of the bucket. |
| GCP.Storage.Bucket.etag | String | The HTTP entity tag of the bucket. |
| GCP.Storage.Bucket.generation | String | The generation number of the bucket. |
| GCP.Storage.Bucket.metageneration | String | The metageneration number of the bucket. |
| GCP.Storage.Bucket.timeCreated | Date | The time the bucket was created. |
| GCP.Storage.Bucket.timeUpdated | Date | The time the bucket was last updated. |
| GCP.Storage.Bucket.selfLink | String | The link to the bucket resource on the GCP API. |
gcp-storage-bucket-get
Retrieves information about a specific bucket. Required permission: storage.buckets.get.
Base Command
gcp-storage-bucket-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.Bucket.id | String | The unique identifier for the bucket. |
| GCP.Storage.Bucket.name | String | The name of the bucket. |
| GCP.Storage.Bucket.kind | String | The type of resource (for example, storage#bucket). |
| GCP.Storage.Bucket.location | String | The location of the bucket. |
| GCP.Storage.Bucket.locationType | String | The type of location (for example, multi-region). |
| GCP.Storage.Bucket.projectNumber | String | The GCP project number associated with the bucket. |
| GCP.Storage.Bucket.storageClass | String | The storage class of the bucket. |
| GCP.Storage.Bucket.rpo | String | The recovery point objective setting of the bucket. |
| GCP.Storage.Bucket.etag | String | The HTTP entity tag of the bucket. |
| GCP.Storage.Bucket.generation | String | The generation number of the bucket. |
| GCP.Storage.Bucket.metageneration | String | The metageneration number of the bucket. |
| GCP.Storage.Bucket.timeCreated | Date | The time the bucket was created. |
| GCP.Storage.Bucket.timeUpdated | Date | The time the bucket was last updated. |
| GCP.Storage.Bucket.selfLink | String | The link to the bucket resource on the GCP API. |
gcp-storage-bucket-objects-list
Retrieves the list of objects in a bucket. Required permission: storage.objects.list.
Base Command
gcp-storage-bucket-objects-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket to list objects from. | Required |
| prefix | Filter results to objects whose names begin with this prefix. | Optional |
| delimiter | Delimiter to use for grouping objects. For example delimiter=”/” Returns results in a directory-like mode, with / being a common value for the delimiter. | Optional |
| limit | Maximum number of objects to return. | Optional |
| page_token | Token for pagination. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.BucketObject.id | String | The unique identifier for the object. |
| GCP.Storage.BucketObject.name | String | The name of the object. |
| GCP.Storage.BucketObject.kind | String | The type of resource (for example, storage#object). |
| GCP.Storage.BucketObject.bucket | String | The name of the bucket containing the object. |
| GCP.Storage.BucketObject.contentType | String | The MIME type of the object. |
| GCP.Storage.BucketObject.size | Number | The size of the object in bytes. |
| GCP.Storage.BucketObject.crc32c | String | The CRC32C checksum of the object. |
| GCP.Storage.BucketObject.md5Hash | String | The MD5 hash of the object. |
| GCP.Storage.BucketObject.etag | String | The HTTP entity tag of the object. |
| GCP.Storage.BucketObject.generation | String | The generation number of the object. |
| GCP.Storage.BucketObject.metageneration | String | The metageneration number of the object. |
| GCP.Storage.BucketObject.storageClass | String | The storage class of the object. |
| GCP.Storage.BucketObject.mediaLink | String | The link for downloading the object content. |
| GCP.Storage.BucketObject.selfLink | String | The link to the object resource in the GCP API. |
| GCP.Storage.BucketObject.timeCreated | Date | The time when the object was created. |
| GCP.Storage.BucketObject.timeFinalized | Date | The time when the object was finalized. |
| GCP.Storage.BucketObject.timeStorageClassUpdated | Date | The time when the object’s storage class was last updated. |
| GCP.Storage.BucketObject.updated | Date | The time when the object was last modified. |
gcp-storage-bucket-policy-list
Retrieves the IAM policy for a bucket. Required permissions: storage.buckets.getIamPolicy, storage.buckets.get.
Base Command
gcp-storage-bucket-policy-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket to retrieve IAM policy from. | Required |
| requested_policy_version | The IAM policy version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn’t support part of the requested IAM policy, the request fails. Required to be 3 or greater for buckets with IAM Conditions. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.BucketPolicy.version | Number | IAM policy version. |
| GCP.Storage.BucketPolicy.etag | String | ETag of the IAM policy. |
| GCP.Storage.BucketPolicy.bindings | List | List of role bindings for the bucket. |
| GCP.Storage.BucketPolicy.resourceId | String | Resource ID of the updated IAM policy. e.g. projects/_/buckets/BUCKET_NAME. |
Usage
- add=false: Replaces the entire bucket IAM policy with the JSON provided in
policy. - add=true: Reads the current bucket policy (getIamPolicy), merges the provided
bindingsper role (deduplicates members), and updates the bucket policy (setIamPolicy) while preserving other top-level fields.
gcp-storage-bucket-policy-set
Sets the IAM policy for a bucket. Required permission: storage.buckets.setIamPolicy.
Base Command
gcp-storage-bucket-policy-set
Usage
- add=false: Replaces the entire bucket IAM policy with the JSON provided in
policy. - add=true: Reads the current bucket policy (getIamPolicy), merges the provided
bindingsper role (deduplicates members), and updates the bucket policy (setIamPolicy) while preserving other top-level fields.
Warning: Use this command with extreme caution. Running it without explicitly merging (i.e., with
add=false) will overwrite the bucket’s existing IAM policy with the providedpolicy. If you intend to keep current bindings and add new ones, useadd=true.
Policy structure
- bindings: Array of binding objects. Each binding:
- role: String. For example,
roles/storage.objectViewer,roles/storage.admin. - members: Array of strings. Allowed formats:
user:<email>(e.g.,user:alice@example.com)group:<email>serviceAccount:<email>domain:<domain>(e.g.,domain:example.com)-
allUsersallAuthenticatedUsers
- role: String. For example,
- version: Number. Required to be
3or greater if any binding includescondition. - etag: String. Recommended for replace flow (
add=false) to avoid overwriting concurrent updates. - Optional fields like
kind,resourceIdmay appear in responses but are not required in requests.
Notes:
- For
add=true(merge), only a validbindingsarray is required; other top-level fields are taken from the existing policy. - For
add=false(replace), the provided object becomes the entire policy on the bucket.
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket to set IAM policy on. | Required |
| policy | JSON string representing the IAM policy to set. | Required |
| add | When true, merges the provided policy bindings into the current bucket policy (per role, deduplicating members) by first calling getIamPolicy and then setIamPolicy with the merged result. When false, replaces the entire policy with the provided JSON via setIamPolicy. . Possible values are: true, false. Default is false. |
Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.BucketPolicy.version | Number | IAM policy version after update. |
| GCP.Storage.BucketPolicy.etag | String | ETag of the updated IAM policy. |
| GCP.Storage.BucketPolicy.bindings | List | List of role bindings for the bucket. |
gcp-storage-bucket-object-policy-list
Retrieves the IAM policy for a specific object in a bucket. Required permission: storage.objects.getIamPolicy.
Base Command
gcp-storage-bucket-object-policy-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket containing the object. | Required |
| object_name | Name of the object to retrieve IAM policy from. | Required |
| generation | Generation of the object. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.BucketObjectPolicy.bucketName | String | Name of the bucket containing the object. |
| GCP.Storage.BucketObjectPolicy.objectName | String | Name of the object. |
| GCP.Storage.BucketObjectPolicy.bindings | List | List of role bindings for the object. |
gcp-storage-bucket-object-policy-set
Sets the IAM policy for a specific object in a bucket. Required permission: storage.objects.setIamPolicy.
Base Command
gcp-storage-bucket-object-policy-set
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| bucket_name | Name of the bucket containing the object. | Required |
| object_name | Name of the object to set IAM policy on. | Required |
| policy | JSON string representing the IAM policy to set. | Required |
| generation | Generation of the object. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Storage.BucketObjectPolicy.version | Number | IAM policy version after update. |
| GCP.Storage.BucketObjectPolicy.etag | String | ETag of the updated IAM policy. |
| GCP.Storage.BucketObjectPolicy.bindings | Unknown | List of role bindings for the object. |
gcp-compute-snapshot-get
Retrieves details for a specific snapshot. Required permission: compute.snapshots.get.
Base Command
gcp-compute-snapshot-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Snapshot name. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Snapshot.id | String | Unique identifier for the snapshot resource. |
| GCP.Compute.Snapshot.name | String | Name of the snapshot resource. |
| GCP.Compute.Snapshot.kind | String | Type of the resource, for example compute#snapshot. |
| GCP.Compute.Snapshot.status | String | Current status of the snapshot, such as READY or FAILED. |
| GCP.Compute.Snapshot.autoCreated | Boolean | Indicates whether the snapshot was automatically created. |
| GCP.Compute.Snapshot.architecture | String | CPU architecture of the source disk, for example X86_64. |
| GCP.Compute.Snapshot.creationTimestamp | Date | The time when the snapshot was created. |
| GCP.Compute.Snapshot.creationSizeBytes | Number | Total size of the snapshot in bytes at creation time. |
| GCP.Compute.Snapshot.diskSizeGb | Number | Size of the snapshot in gigabytes. |
| GCP.Compute.Snapshot.downloadBytes | Number | Total bytes downloaded to create the snapshot. |
| GCP.Compute.Snapshot.enableConfidentialCompute | Boolean | Indicates if confidential compute is enabled for this snapshot. |
| GCP.Compute.Snapshot.labelFingerprint | String | Fingerprint for the labels applied to the snapshot. |
| GCP.Compute.Snapshot.licenseCodes | Unknown | List of license code identifiers attached to the snapshot. |
| GCP.Compute.Snapshot.licenses | Unknown | List of license URLs associated with the snapshot. |
| GCP.Compute.Snapshot.selfLink | String | Server-defined URL for the snapshot resource. |
| GCP.Compute.Snapshot.sourceDisk | String | URL of the source disk used to create the snapshot. |
| GCP.Compute.Snapshot.sourceDiskId | String | Unique ID of the source disk used to create the snapshot. |
| GCP.Compute.Snapshot.sourceSnapshotSchedulePolicy | String | URL of the snapshot schedule policy used to create this snapshot. |
| GCP.Compute.Snapshot.sourceSnapshotSchedulePolicyId | String | Unique ID of the snapshot schedule policy used to create this snapshot. |
| GCP.Compute.Snapshot.storageBytes | Number | Total storage size of the snapshot in bytes. |
| GCP.Compute.Snapshot.storageBytesStatus | String | Status of the storage bytes usage, for example UP_TO_DATE. |
| GCP.Compute.Snapshot.storageLocations | Unknown | List of storage locations for the snapshot. |
gcp-compute-instances-aggregated-list-by-ip
Returns an aggregated list of instances across all zones that can be filtered by internal or external IP. Required permission: cloudasset.assets.searchAllResources.
Base Command
gcp-compute-instances-aggregated-list-by-ip
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| ip_address | The IP address to search for. | Required |
| match_external | If true, match against external NAT IPs; otherwise internal NIC IPs. Possible values are: true, false. | Optional |
| limit | Maximum number of results to return. Acceptable values are 0 to 500, inclusive. Default is 50. | Optional |
| page_token | Token for pagination. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Instance.name | string | Instance name. |
| GCP.Compute.Instance.id | string | Instance ID. |
| GCP.Compute.Instance.zone | string | Instance zone URL. |
| GCP.Compute.Instance.status | string | Instance status. |
| GCP.Compute.Instance.networkInterfaces | Unknown | Network interfaces of the instance. |
gcp-compute-network-tag-set
Adds a network tag to a VM instance (merges with existing tags). Required permission: compute.instances.setTags.
Base Command
gcp-compute-network-tag-set
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | Zone of the VM (e.g., us-central1-a). | Required |
| resource_name | Instance name. | Required |
| tag | Tag to add. | Required |
| tags_fingerprint | Fingerprint of the previous set of tags for this resource, used to prevent conflicts. Provide the latest fingerprint value when making a request to add or change tags. To retrieve the fingerprint use the command gcp-compute-instance-get. | Required |
| add_tag | If true, adds the tag to the existing tags; otherwise, overrides them. The default is true. Possible values are: true, false. Default is true. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | Operation ID. |
| GCP.Compute.Operations.name | string | Operation name. |
| GCP.Compute.Operations.status | string | Current operation status (e.g., RUNNING, DONE). |
| GCP.Compute.Operations.operationType | string | Type of operation being performed. |
| GCP.Compute.Operations.progress | number | Operation progress percentage (0-100). |
| GCP.Compute.Operations.user | string | User or service account that initiated the operation. |
| GCP.Compute.Operations.targetLink | string | Full URL of the target resource for this operation. |
| GCP.Compute.Operations.targetId | string | Target resource ID. |
| GCP.Compute.Operations.zone | string | Zone where the operation is performed. |
| GCP.Compute.Operations.insertTime | string | Time when the operation was inserted. |
| GCP.Compute.Operations.startTime | string | Time when the operation started. |
| GCP.Compute.Operations.selfLink | string | URL for this operation resource. |
| GCP.Compute.Operations.kind | string | Type of the resource (e.g., compute#operation). |
gcp-compute-image-get
Returns a specific image. Required permission: compute.images.get.
Base Command
gcp-compute-image-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | Project ID for this request. Required for Cortex XSIAM (version >= 3.0) and Cortex Cloud; optional for Cortex XSOAR and Cortex XSIAM (version < 3.0), where it can be retrieved from the integration configuration. | Optional |
| image | Name of the image resource to return. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Images.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Images.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Images.name | string | Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Images.description | string | An optional description of this resource. |
| GCP.Compute.Images.sourceType | string | The type of the image used to create this disk. The default and only value is RAW. |
| GCP.Compute.Images.rawDisk | string | The parameters of the raw disk image. |
| GCP.Compute.Images.rawDisk.source | string | The full Google Cloud Storage URL where the disk image is stored. You must provide either this property or the sourceDisk property but not both. |
| GCP.Compute.Images.rawDisk.sha1Checksum | string | An optional SHA1 checksum of the disk image before unpackaging provided by the client when the disk image is created. |
| GCP.Compute.Images.rawDisk.containerType | string | The format used to encode and transmit the block device, which should be TAR. This is just a container and transmission format and not a runtime format. Provided by the client when the disk image is created. |
| GCP.Compute.Images.deprecated | string | The deprecation status associated with this image. |
| GCP.Compute.Images.deprecated.state | string | The deprecation state of this resource. This can be ACTIVE DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. |
| GCP.Compute.Images.deprecated.replacement | string | The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. |
| GCP.Compute.Images.deprecated.deprecated | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.deprecated.obsolete | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.deprecated.deleted | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.status | string | The status of the image. An image can be used to create other resources, such as instances, only after the image has been successfully created and the status is set to READY. Possible values are FAILED, PENDING, or READY. |
| GCP.Compute.Images.archiveSizeBytes | string | Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). |
| GCP.Compute.Images.diskSizeGb | string | Size of the image when restored onto a persistent disk (in GB). |
| GCP.Compute.Images.sourceDisk | string | URL of the source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk , projects/project/zones/zone/disks/disk , zones/zone/disks/disk. |
| GCP.Compute.Images.sourceDiskId | string | The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name. |
| GCP.Compute.Images.licenses | string | Any applicable license URI. |
| GCP.Compute.Images.family | string | The name of the image family to which this image belongs. You can create disks by specifying an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035. |
| GCP.Compute.Images.imageEncryptionKey | string | Encrypts the image using a customer-supplied encryption key. After you encrypt an image with a customer-supplied key, you must provide the same key if you use the image later (e.g. to create a disk from the image). Customer-supplied encryption keys do not protect access to metadata of the disk. If you do not provide an encryption key when creating the image, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the image later. |
| GCP.Compute.Images.imageEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.imageEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.imageEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.sourceDiskEncryptionKey | string | The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceDiskEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceDiskEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceDiskEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Images.labels | string | Labels to apply to this image. These can be later modified by the setLabels method. |
| GCP.Compute.Images.labelFingerprint | string | A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. |
| GCP.Compute.Images.guestOsFeatures | string | A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. |
| GCP.Compute.Images.guestOsFeatures.type | string | The ID of a supported feature. Read Enabling guest operating system features to see a list of available options. |
| GCP.Compute.Images.licenseCodes | string | Integer license codes indicating which licenses are attached to this image. |
| GCP.Compute.Images.sourceImage | string | URL of the source image used to create this image. This can be a full or valid partial URL. |
| GCP.Compute.Images.sourceImageId | string | The ID value of the image used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given image name. |
| GCP.Compute.Images.sourceImageEncryptionKey | string | The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceImageEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceImageEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceImageEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.sourceSnapshot | string | URL of the source snapshot used to create this image. This can be a full or valid partial URL. |
| GCP.Compute.Images.sourceSnapshotId | string | The ID value of the snapshot used to create this image. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given snapshot name. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey | string | The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.kind | string | Type of the resource. Always compute#image for images. |
gcp-compute-instance-group-get
Returns a specific instance group. Required permission: compute.instanceGroups.get.
Base Command
gcp-compute-instance-group-get
Input
| Argument Name | Description | Required |
|---|---|---|
| instance_group | The name of the instance group. | Required |
| project_id | The GCP project ID. Required for Cortex XSIAM (version >= 3.0) and Cortex Cloud; optional for Cortex XSOAR and Cortex XSIAM (version < 3.0), where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone where the instance group is located. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.InstanceGroups.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.InstanceGroups.creationTimestamp | string | The creation timestamp for this instance group in RFC3339 text format. |
| GCP.Compute.InstanceGroups.name | string | The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. |
| GCP.Compute.InstanceGroups.description | string | An optional description of this resource. |
| GCP.Compute.InstanceGroups.namedPorts | string | Assigns a name to a port number. |
| GCP.Compute.InstanceGroups.namedPorts.name | string | The name for this named port. The name must be 1-63 characters long, and comply with RFC1035. |
| GCP.Compute.InstanceGroups.namedPorts.port | string | The port number, which can be a value between 1 and 65535. |
| GCP.Compute.InstanceGroups.network | string | The URL of the network to which all instances in the instance group belong. |
| GCP.Compute.InstanceGroups.fingerprint | string | The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. |
| GCP.Compute.InstanceGroups.zone | string | The URL of the zone where the instance group is located (for zonal resources). |
| GCP.Compute.InstanceGroups.selfLink | string | The URL for this instance group. The server generates this URL. |
| GCP.Compute.InstanceGroups.size | string | The total number of instances in the instance group. |
| GCP.Compute.InstanceGroups.region | string | The URL of the region where the instance group is located (for regional resources). |
| GCP.Compute.InstanceGroups.subnetwork | string | The URL of the subnetwork to which all instances in the instance group belong. |
| GCP.Compute.InstanceGroups.kind | string | The resource type, which is always compute#instance_group for instance groups. |
gcp-compute-region-get
Returns a specific region resource. Required permission: compute.regions.get.
Base Command
gcp-compute-region-get
Input
| Argument Name | Description | Required |
|---|---|---|
| region | Name of the region resource to return. | Required |
| project_id | The GCP project ID. Required for Cortex XSIAM (version >= 3.0) and Cortex Cloud; optional for Cortex XSOAR and Cortex XSIAM (version < 3.0), where it can be retrieved from the integration configuration. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Regions.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Regions.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Regions.name | string | Name of the resource. |
| GCP.Compute.Regions.description | string | Textual description of the resource. |
| GCP.Compute.Regions.status | string | Status of the region, either UP or DOWN. |
| GCP.Compute.Regions.zones | string | A list of zones available in this region, in the form of resource URLs. |
| GCP.Compute.Regions.quotas | string | Quotas assigned to this region. |
| GCP.Compute.Regions.quotas.metric | string | Name of the quota metric. |
| GCP.Compute.Regions.quotas.limit | string | Quota limit for this metric. |
| GCP.Compute.Regions.quotas.usage | string | Current usage of this metric. |
| GCP.Compute.Regions.quotas.owner | string | Owning resource. The resource to which this quota applies. |
| GCP.Compute.Regions.deprecated | string | The deprecation status associated with this region. |
| GCP.Compute.Regions.deprecated.state | string | The deprecation state of this resource. This can be ACTIVE DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. |
| GCP.Compute.Regions.deprecated.replacement | string | The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. |
| GCP.Compute.Regions.deprecated.deprecated | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.deprecated.obsolete | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.deprecated.deleted | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Regions.kind | string | Type of the resource. Always compute#region for regions. |
gcp-compute-zone-get
Returns a specific zone resource. Required permission: compute.zones.get.
Base Command
gcp-compute-zone-get
gcp-compute-image-get
Returns a specific image. Required permission: compute.images.get.
Base Command
gcp-compute-image-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The project ID for this request. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| image | Name of the image resource to return. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Images.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Images.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Images.name | string | Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Images.description | string | An optional description of this resource. |
| GCP.Compute.Images.sourceType | string | The type of the image used to create this disk. The default and only value is RAW. |
| GCP.Compute.Images.rawDisk | string | The parameters of the raw disk image. |
| GCP.Compute.Images.rawDisk.source | string | The full Google Cloud Storage URL where the disk image is stored. You must provide either this property or the sourceDisk property but not both. |
| GCP.Compute.Images.rawDisk.sha1Checksum | string | An optional SHA1 checksum of the disk image before unpackaging provided by the client when the disk image is created. |
| GCP.Compute.Images.rawDisk.containerType | string | The format used to encode and transmit the block device, which should be TAR. This is just a container and transmission format and not a runtime format. Provided by the client when the disk image is created. |
| GCP.Compute.Images.deprecated | string | The deprecation status associated with this image. |
| GCP.Compute.Images.deprecated.state | string | The deprecation state of this resource. This can be ACTIVE DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. |
| GCP.Compute.Images.deprecated.replacement | string | The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. |
| GCP.Compute.Images.deprecated.deprecated | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.deprecated.obsolete | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.deprecated.deleted | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Images.status | string | The status of the image. An image can be used to create other resources, such as instances, only after the image has been successfully created and the status is set to READY. Possible values are FAILED, PENDING, or READY. |
| GCP.Compute.Images.archiveSizeBytes | string | Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). |
| GCP.Compute.Images.diskSizeGb | string | Size of the image when restored onto a persistent disk (in GB). |
| GCP.Compute.Images.sourceDisk | string | URL of the source disk used to create this image. This can be a full or valid partial URL. You must provide either this property or the rawDisk.source property but not both to create an image. For example, the following are valid values: https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk , projects/project/zones/zone/disks/disk , zones/zone/disks/disk. |
| GCP.Compute.Images.sourceDiskId | string | The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name. |
| GCP.Compute.Images.licenses | string | Any applicable license URI. |
| GCP.Compute.Images.family | string | The name of the image family to which this image belongs. You can create disks by specifying an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035. |
| GCP.Compute.Images.imageEncryptionKey | string | Encrypts the image using a customer-supplied encryption key. After you encrypt an image with a customer-supplied key, you must provide the same key if you use the image later (e.g. to create a disk from the image). Customer-supplied encryption keys do not protect access to metadata of the disk. If you do not provide an encryption key when creating the image, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the image later. |
| GCP.Compute.Images.imageEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.imageEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.imageEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.sourceDiskEncryptionKey | string | The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceDiskEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceDiskEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceDiskEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Images.labels | string | Labels to apply to this image. These can be later modified by the setLabels method. |
| GCP.Compute.Images.labelFingerprint | string | A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. |
| GCP.Compute.Images.guestOsFeatures | string | A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. |
| GCP.Compute.Images.guestOsFeatures.type | string | The ID of a supported feature. Read Enabling guest operating system features to see a list of available options. |
| GCP.Compute.Images.licenseCodes | string | Integer license codes indicating which licenses are attached to this image. |
| GCP.Compute.Images.sourceImage | string | URL of the source image used to create this image. This can be a full or valid partial URL. |
| GCP.Compute.Images.sourceImageId | string | The ID value of the image used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given image name. |
| GCP.Compute.Images.sourceImageEncryptionKey | string | The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceImageEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceImageEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceImageEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.sourceSnapshot | string | URL of the source snapshot used to create this image. This can be a full or valid partial URL. |
| GCP.Compute.Images.sourceSnapshotId | string | The ID value of the snapshot used to create this image. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given snapshot name. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey | string | The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.rawKey | string | Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.kmsKeyName | string | The name of the encryption key that is stored in Google Cloud KMS. |
| GCP.Compute.Images.sourceSnapshotEncryptionKey.sha256 | string | The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. |
| GCP.Compute.Images.kind | string | Type of the resource. Always compute#image for images. |
gcp-compute-instance-group-get
Returns a specific instance group. Required permission: compute.instanceGroups.get.
Base Command
gcp-compute-instance-group-get
Input
| Argument Name | Description | Required |
|---|---|---|
| instance_group | The name of the instance group. | Required |
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| zone | The name of the zone where the instance group is located. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.InstanceGroups.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.InstanceGroups.creationTimestamp | string | The creation timestamp for this instance group in RFC3339 text format. |
| GCP.Compute.InstanceGroups.name | string | The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. |
| GCP.Compute.InstanceGroups.description | string | An optional description of this resource. |
| GCP.Compute.InstanceGroups.namedPorts | string | Assigns a name to a port number. |
| GCP.Compute.InstanceGroups.namedPorts.name | string | The name for this named port. The name must be 1-63 characters long, and comply with RFC1035. |
| GCP.Compute.InstanceGroups.namedPorts.port | string | The port number, which can be a value between 1 and 65535. |
| GCP.Compute.InstanceGroups.network | string | The URL of the network to which all instances in the instance group belong. |
| GCP.Compute.InstanceGroups.fingerprint | string | The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. |
| GCP.Compute.InstanceGroups.zone | string | The URL of the zone where the instance group is located (for zonal resources). |
| GCP.Compute.InstanceGroups.selfLink | string | The URL for this instance group. The server generates this URL. |
| GCP.Compute.InstanceGroups.size | string | The total number of instances in the instance group. |
| GCP.Compute.InstanceGroups.region | string | The URL of the region where the instance group is located (for regional resources). |
| GCP.Compute.InstanceGroups.subnetwork | string | The URL of the subnetwork to which all instances in the instance group belong. |
| GCP.Compute.InstanceGroups.kind | string | The resource type, which is always compute#instance_group for instance groups. |
gcp-compute-region-get
Returns a specific region resource. Required permission: compute.regions.get.
Base Command
gcp-compute-region-get
Input
| Argument Name | Description | Required |
|---|---|---|
| region | Name of the region resource to return. | Required |
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Regions.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Regions.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Regions.name | string | Name of the resource. |
| GCP.Compute.Regions.description | string | Textual description of the resource. |
| GCP.Compute.Regions.status | string | Status of the region, either UP or DOWN. |
| GCP.Compute.Regions.zones | string | A list of zones available in this region, in the form of resource URLs. |
| GCP.Compute.Regions.quotas | string | Quotas assigned to this region. |
| GCP.Compute.Regions.quotas.metric | string | Name of the quota metric. |
| GCP.Compute.Regions.quotas.limit | string | Quota limit for this metric. |
| GCP.Compute.Regions.quotas.usage | string | Current usage of this metric. |
| GCP.Compute.Regions.quotas.owner | string | Owning resource. The resource to which this quota applies. |
| GCP.Compute.Regions.deprecated | string | The deprecation status associated with this region. |
| GCP.Compute.Regions.deprecated.state | string | The deprecation state of this resource. This can be ACTIVE DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. |
| GCP.Compute.Regions.deprecated.replacement | string | The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. |
| GCP.Compute.Regions.deprecated.deprecated | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.deprecated.obsolete | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.deprecated.deleted | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Regions.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Regions.kind | string | Type of the resource. Always compute#region for regions. |
gcp-compute-zone-get
Returns a specific zone resource. Required permission: compute.zones.get.
Base Command
gcp-compute-zone-get
Input
| Argument Name | Description | Required |
|---|---|---|
| zone | Name of the zone resource to return. | Required |
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Zones.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Zones.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Zones.name | string | Name of the resource. |
| GCP.Compute.Zones.description | string | Textual description of the resource. |
| GCP.Compute.Zones.status | string | Status of the zone, either UP or DOWN. |
| GCP.Compute.Zones.deprecated | string | The deprecation status associated with this zone. |
| GCP.Compute.Zones.deprecated.state | string | The deprecation state of this resource. This can be ACTIVE DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. |
| GCP.Compute.Zones.deprecated.replacement | string | The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. |
| GCP.Compute.Zones.deprecated.deprecated | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Zones.deprecated.obsolete | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Zones.deprecated.deleted | string | An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DELETED. This is only informational and the status will not change unless the client explicitly changes it. |
| GCP.Compute.Zones.region | string | Full URL reference to the region which hosts the zone. |
| GCP.Compute.Zones.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Zones.availableCpuPlatforms | string | Available cpu/platform selections for the zone. Do not use field = 7 or field = 11. Next available field = 14. |
| GCP.Compute.Zones.kind | string | Type of the resource. Always compute#zone for zones. |
gcp-compute-networks-list
Retrieves a list of networks available for the specified project. Required permission: compute.networks.list.
Base Command
gcp-compute-networks-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| limit | The maximum number of results per page that should be returned. If the number of available results is larger than limit, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 50, inclusive. Default is 50. | Optional |
| filters | A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. | Optional |
| order_by | Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using order_by=”creationTimestamp desc”. This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. | Optional |
| page_token | Specifies a page token to use. Set page_token to the nextPageToken returned by a previous list request to get the next page of results. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Networks.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Networks.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Networks.name | string | Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Networks.description | string | An optional description of this resource. |
| GCP.Compute.Networks.gatewayIPv4 | string | The gateway address for default routing out of the network. This value is read only and is selected by GCP. |
| GCP.Compute.Networks.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Networks.autoCreateSubnetworks | boolean | When set to true, the VPC network is created in “auto” mode. When set to false, the VPC network is created in “custom” mode. |
| GCP.Compute.Networks.subnetworks | string | Server-defined fully-qualified URLs for all subnetworks in this VPC network. |
| GCP.Compute.Networks.peerings | string | A list of network peerings for the resource. |
| GCP.Compute.Networks.peerings.name | string | Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Networks.peerings.network | string | The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. |
| GCP.Compute.Networks.peerings.state | string | State for the peering. |
| GCP.Compute.Networks.peerings.stateDetails | string | Details about the current state of the peering. |
| GCP.Compute.Networks.peerings.autoCreateRoutes | boolean | This field will be deprecated soon. Prefer using exchangeSubnetRoutes instead. Indicates whether full mesh connectivity is created and managed automatically. When set to true, Google Compute Engine automatically creates and manages the routes between two networks while the state is ACTIVE. If set to false, the user must manually create routes to direct packets to the peer network. |
| GCP.Compute.Networks.peerings.exchangeSubnetRoutes | boolean | Whether full mesh connectivity is created and managed automatically. When set to true, Google Compute Engine automatically creates and manages the routes between two networks while the peering state is ACTIVE. If set to false, the user must manually create routes to send packets to the peer network. |
| GCP.Compute.Networks.routingConfig | string | The network-level routing configuration for this network. Used by Cloud Router to determine what type of network-wide routing behavior to enforce. |
| GCP.Compute.Networks.routingConfig.routingMode | string | Specifies the network-wide routing mode. If set to REGIONAL, the network’s cloud routers advertise routes only for subnets in the same region as the router. If set to GLOBAL, cloud routers advertise routes for all subnets in the network across all regions. |
| GCP.Compute.Networks.kind | string | Type of the resource. Always compute#network for networks. |
gcp-compute-network-insert
Creates a network in the specified project using the data included in the request. Required permission: compute.networks.create.
Base Command
gcp-compute-network-insert
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| name | Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. | Required |
| description | An optional description of this resource. | Optional |
| auto_create_sub_networks | When set to true, the VPC network is created in “auto” mode. When set to false, the VPC network is created in “custom” mode. An auto mode VPC network starts with one subnet per region. Each subnet has a predetermined range as described in Auto mode VPC network IP ranges. Possible values are: true, false. | Optional |
| routing_config_routing_mode | The network-wide routing mode to use. If set to REGIONAL, this network’s cloud routers will only advertise routes with subnets of this network in the same region as the router. If set to GLOBAL, this network’s cloud routers will advertise routes with all subnets of this network, across regions. Possible values are: REGIONAL, GLOBAL. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Operations.name | string | Name of the resource. |
| GCP.Compute.Operations.zone | string | The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
| GCP.Compute.Operations.clientOperationId | string | The value of requestId if you provided it in the request. Not present otherwise. |
| GCP.Compute.Operations.operationType | string | The type of operation, such as insert, update, or delete, and so on. |
| GCP.Compute.Operations.targetLink | string | The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. |
| GCP.Compute.Operations.targetId | string | The unique target ID, which identifies a specific incarnation of the target resource. |
| GCP.Compute.Operations.status | string | The status of the operation, which can be one of the following: PENDING RUNNING or DONE. |
| GCP.Compute.Operations.statusMessage | string | An optional textual description of the current status of the operation. |
| GCP.Compute.Operations.user | string | User who requested the operation for example EMAILADDRESS. |
| GCP.Compute.Operations.progress | number | An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| GCP.Compute.Operations.insertTime | string | The time that this operation was requested. This value is in RFC3339 text format. |
| GCP.Compute.Operations.startTime | string | The time that this operation was started by the server. This value is in RFC3339 text format. |
| GCP.Compute.Operations.endTime | string | The time that this operation was completed. This value is in RFC3339 text format. |
| GCP.Compute.Operations.error | string | If errors are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.error.errors | string | The array of errors encountered while processing this operation. |
| GCP.Compute.Operations.error.errors | string | The error type identifier for this error. |
| GCP.Compute.Operations.error.errors | string | Indicates the field in the request that caused the error. This property is optional. |
| GCP.Compute.Operations.error.errors | string | An optional, human-readable error message. |
| GCP.Compute.Operations.warnings | string | If warning messages are generated during processing of the operation, this field will be populated. |
| GCP.Compute.Operations.warnings.code | string | A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. |
| GCP.Compute.Operations.warnings.message | string | A human-readable description of the warning code. |
| GCP.Compute.Operations.warnings.data | string | Metadata about this warning in key: value format. |
| GCP.Compute.Operations.warnings.data | string | A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). |
| GCP.Compute.Operations.warnings.data | string | A warning data value corresponding to the key. |
| GCP.Compute.Operations.httpErrorStatusCode | number | If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. |
| GCP.Compute.Operations.httpErrorMessage | string | If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. |
| GCP.Compute.Operations.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Operations.region | string | The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
| GCP.Compute.Operations.description | string | A textual description of the operation, which is set when the operation is created. |
| GCP.Compute.Operations.kind | string | Type of the resource. Always compute#operation for Operation resources. |
gcp-compute-network-get
Returns the specified network.
Base Command
gcp-compute-network-get
Input
| Argument Name | Description | Required |
|---|---|---|
| network | Name of the network to return. | Required |
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Networks.id | string | The unique identifier for the resource. This identifier is defined by the server. |
| GCP.Compute.Networks.creationTimestamp | string | Creation timestamp in RFC3339 text format. |
| GCP.Compute.Networks.name | string | Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Networks.description | string | An optional description of this resource. |
| GCP.Compute.Networks.gatewayIPv4 | string | The gateway address for default routing out of the network. This value is read only and is selected by GCP. |
| GCP.Compute.Networks.selfLink | string | Server-defined URL for the resource. |
| GCP.Compute.Networks.autoCreateSubnetworks | boolean | When set to true, the VPC network is created in “auto” mode. When set to false, the VPC network is created in “custom” mode. |
| GCP.Compute.Networks.subnetworks | string | Server-defined fully-qualified URLs for all subnetworks in this VPC network. |
| GCP.Compute.Networks.peerings | string | A list of network peerings for the resource. |
| GCP.Compute.Networks.peerings.name | string | Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| GCP.Compute.Networks.peerings.network | string | The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. |
| GCP.Compute.Networks.peerings.state | string | State for the peering. |
| GCP.Compute.Networks.peerings.stateDetails | string | Details about the current state of the peering. |
| GCP.Compute.Networks.peerings.autoCreateRoutes | boolean | This field will be deprecated soon. Prefer using exchangeSubnetRoutes instead. Indicates whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network. |
| GCP.Compute.Networks.peerings.exchangeSubnetRoutes | boolean | Whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the peering state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network. |
| GCP.Compute.Networks.routingConfig | string | The network-level routing configuration for this network. Used by Cloud Router to determine what type of network-wide routing behavior to enforce. |
| GCP.Compute.Networks.routingConfig.routingMode | string | The network-wide routing mode to use. If set to REGIONAL, this networks cloud routers will only advertise routes with subnets of this network in the same region as the router. If set to GLOBAL, this networks cloud routers will advertise routes with all subnets of this network, across regions. |
| GCP.Compute.Networks.kind | string | Type of the resource. Always compute#network for networks. |
gcp-compute-firewall-insert
Creates a new firewall rule in a specific project. Required permission: compute.firewalls.create.
Base Command
gcp-compute-firewall-insert
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Name of the firewall rule to create. | Required |
| description | An optional description for the firewall rule. | Optional |
| network | URL of the network, e.g., global/networks/default. | Optional |
| priority | Priority 0-65535. Default 1000. | Optional |
| direction | Direction of traffic to which this firewall applies. Default INGRESS. Possible values are: INGRESS, EGRESS. Default is INGRESS. | Optional |
| allowed | ALLOW rules in tuples, e.g., ipprotocol=tcp,ports=443;ipprotocol=tcp,ports=80. | Optional |
| denied | DENY rules in tuples, e.g., ipprotocol=tcp,ports=22,443. | Optional |
| source_ranges | Comma-separated CIDRs for INGRESS. | Optional |
| destination_ranges | Comma-separated CIDRs for EGRESS. | Optional |
| source_tags | Comma-separated instance tags to match as source. | Optional |
| target_tags | Comma-separated tags to apply this rule to. | Optional |
| source_service_accounts | Comma-separated service accounts for source. | Optional |
| target_service_accounts | Comma-separated service accounts to target. | Optional |
| log_config_enable | Enable firewall logging. Possible values are: true, false. | Optional |
| disabled | Whether this firewall rule is disabled. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Operations.id | String | Unique identifier for the operation resource, defined by the server. |
| GCP.Compute.Operations.name | String | Name of the operation resource. |
| GCP.Compute.Operations.kind | String | Type of the resource, for example compute#operation. |
| GCP.Compute.Operations.operationType | String | Type of operation, such as insert, update, or delete. |
| GCP.Compute.Operations.status | String | Current status of the operation. |
| GCP.Compute.Operations.progress | Number | Progress of the operation as a percentage between 0 and 100. |
| GCP.Compute.Operations.targetId | String | Unique target ID of the resource affected by the operation. |
| GCP.Compute.Operations.targetLink | String | URL of the target resource modified by the operation. |
| GCP.Compute.Operations.selfLink | String | Server-defined URL for the operation resource. |
| GCP.Compute.Operations.insertTime | Date | The time when the operation resource was created. |
| GCP.Compute.Operations.startTime | Date | The time when the operation started running. |
| GCP.Compute.Operations.user | String | The user account that performed the operation. |
gcp-compute-firewall-list
Lists the firewall rules in a specific project. Required permission: compute.firewalls.list.
Base Command
gcp-compute-firewall-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| limit | Maximum number of results to return. Acceptable values are 0 to 500, inclusive. Default is 50. | Optional |
| page_token | Token for pagination. | Optional |
| filter | A filter expression for resources listed in the response. The expression must specify a field name, a comparison operator (=, !=, >, or <), and a value, which can be a string, number, or boolean. For example, to exclude a Compute Engine instance named example-instance, use name != example-instance. For more options and details, see: https://cloud.google.com/compute/docs/reference/rest/v1/firewalls/list#:~:text=page%20of%20results.-,filter,-string. |
Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Firewall.id | String | Unique identifier for the firewall rule. |
| GCP.Compute.Firewall.name | String | Name of the firewall rule. |
| GCP.Compute.Firewall.kind | String | Type of the resource (for example, compute#firewall). |
| GCP.Compute.Firewall.description | String | Description of the firewall rule. |
| GCP.Compute.Firewall.direction | String | Direction of traffic for the rule (INGRESS or EGRESS). |
| GCP.Compute.Firewall.disabled | Boolean | Indicates whether the firewall rule is disabled. |
| GCP.Compute.Firewall.priority | Number | Priority value of the firewall rule. |
| GCP.Compute.Firewall.network | String | The network URL this firewall rule applies to. |
| GCP.Compute.Firewall.selfLink | String | Server-defined URL for the resource. |
| GCP.Compute.Firewall.creationTimestamp | Date | The creation timestamp of the firewall rule. |
| GCP.Compute.Firewall.logConfig.enable | Boolean | Indicates whether logging is enabled for the firewall rule. |
| GCP.Compute.Firewall.sourceRanges | Unknown | List of source IP ranges that the rule applies to. |
| GCP.Compute.Firewall.targetTags | Unknown | List of target instance tags to which the rule applies. |
| GCP.Compute.FirewallNextToken | String | Next page token for pagination. |
gcp-compute-firewall-get
Retrieves a specific firewall rule by name. Required permission: compute.firewalls.get.
Base Command
gcp-compute-firewall-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| resource_name | Firewall rule name. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Firewall.name | string | Firewall rule name. |
| GCP.Compute.Firewall.network | string | Network URL for the firewall rule. |
| GCP.Compute.Firewall.direction | string | Direction of traffic (INGRESS/EGRESS). |
| GCP.Compute.Firewall.priority | number | Priority of the rule. |
| GCP.Compute.Firewall.allowed | Unknown | Allowed tuples. |
| GCP.Compute.Firewall.denied | Unknown | Denied tuples. |
| GCP.Compute.Firewall.targetTags | Unknown | Target instance tags. |
gcp-compute-snapshots-list
Lists snapshots in a specific project. Required permission: compute.snapshots.list.
Base Command
gcp-compute-snapshots-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| limit | Maximum number of results to return. Acceptable values are 0 to 500, inclusive. Default is 50. | Optional |
| page_token | Token for pagination. | Optional |
| filter | A filter expression for resources listed in the response. The expression must specify a field name, a comparison operator (=, !=, >, or <), and a value, which can be a string, number, or boolean. For example, to exclude a Compute Engine instance named example-instance, use name != example-instance. For more options and details, see: https://cloud.google.com/compute/docs/reference/rest/v1/snapshots/list#:~:text=page%20of%20results.-,filter,-string. |
Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.Compute.Snapshot.id | String | Unique identifier for the snapshot resource. |
| GCP.Compute.Snapshot.name | String | Name of the snapshot resource. |
| GCP.Compute.Snapshot.kind | String | Type of the resource, for example compute#snapshot. |
| GCP.Compute.Snapshot.status | String | Current status of the snapshot, such as READY or FAILED. |
| GCP.Compute.Snapshot.autoCreated | Boolean | Indicates whether the snapshot was automatically created. |
| GCP.Compute.Snapshot.architecture | String | CPU architecture of the source disk, for example X86_64. |
| GCP.Compute.Snapshot.creationTimestamp | Date | The time when the snapshot was created. |
| GCP.Compute.Snapshot.creationSizeBytes | Number | Total size of the snapshot in bytes at creation time. |
| GCP.Compute.Snapshot.diskSizeGb | Number | Size of the snapshot in gigabytes. |
| GCP.Compute.Snapshot.downloadBytes | Number | Total bytes downloaded to create the snapshot. |
| GCP.Compute.Snapshot.enableConfidentialCompute | Boolean | Indicates if confidential compute is enabled for this snapshot. |
| GCP.Compute.Snapshot.labelFingerprint | String | Fingerprint for the labels applied to the snapshot. |
| GCP.Compute.Snapshot.licenseCodes | Unknown | List of license code identifiers attached to the snapshot. |
| GCP.Compute.Snapshot.licenses | Unknown | List of license URLs associated with the snapshot. |
| GCP.Compute.Snapshot.selfLink | String | Server-defined URL for the snapshot resource. |
| GCP.Compute.Snapshot.sourceDisk | String | URL of the source disk used to create the snapshot. |
| GCP.Compute.Snapshot.sourceDiskId | String | Unique ID of the source disk used to create the snapshot. |
| GCP.Compute.Snapshot.sourceSnapshotSchedulePolicy | String | URL of the snapshot schedule policy used to create this snapshot. |
| GCP.Compute.Snapshot.sourceSnapshotSchedulePolicyId | String | Unique ID of the snapshot schedule policy used to create this snapshot. |
| GCP.Compute.Snapshot.storageBytes | Number | Total storage size of the snapshot in bytes. |
| GCP.Compute.Snapshot.storageBytesStatus | String | Status of the storage bytes usage, for example UP_TO_DATE. |
| GCP.Compute.Snapshot.storageLocations | Unknown | List of storage locations for the snapshot. |
| GCP.Compute.SnapshotNextToken | String | Next page token for pagination. |
gcp-bq-dataset-policy-remove
Removes an email from the BigQuery dataset policy. Required Permissions: bigquery.datasets.update, bigquery.datasets.get, bigquery.datasets.getIamPolicy, bigquery.datasets.setIamPolicy.
Base Command
gcp-bq-dataset-policy-remove
Input
| Argument Name | Description | Required |
|---|---|---|
| project_id | The GCP project ID. Required for Cortex Platform (which includes Cortex XSIAM version >=3.0 and Cortex Cloud). Optional for Cortex XSOAR and Cortex XSIAM version < 3.0, where it can be retrieved from the integration configuration. | Optional |
| dataset_id | The dataset ID of the requested dataset. | Required |
| The email address to remove from the dataset access list. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| GCP.BigQuery.Datasets.kind | String | The resource type. |
| GCP.BigQuery.Datasets.etag | String | A hash of the resource. |
| GCP.BigQuery.Datasets.id | String | The fully-qualified unique name of the dataset in the format projectId:datasetId. |
| GCP.BigQuery.Datasets.selfLink | String | A URL that can be used to access the resource again. |
| GCP.BigQuery.Datasets.datasetReference | Unknown | A reference that identifies the dataset. |
| GCP.BigQuery.Datasets.friendlyName | String | A descriptive name for the dataset. |
| GCP.BigQuery.Datasets.description | String | A user-friendly description of the dataset. |
| GCP.BigQuery.Datasets.defaultTableExpirationMs | String | The default lifetime of all tables in the dataset, in milliseconds. |
| GCP.BigQuery.Datasets.defaultPartitionExpirationMs | String | The default partition expiration, in milliseconds. |
| GCP.BigQuery.Datasets.labels | String | The labels associated with this dataset. |
| GCP.BigQuery.Datasets.access.role | String | The role assigned to the entity. |
| GCP.BigQuery.Datasets.access.userByEmail | String | An email address of a user to grant access to. |
| GCP.BigQuery.Datasets.access.groupByEmail | String | An email address of a group to grant access to. |
| GCP.BigQuery.Datasets.access.domain | String | A domain to grant access to. |
| GCP.BigQuery.Datasets.access.specialGroup | String | A special group to grant access to. |
| GCP.BigQuery.Datasets.access.iamMember | String | A type of member that appears in the IAM Policy that isn’t a user, group, domain, or special group. |
| GCP.BigQuery.Datasets.access.view | Unknown | A view from a different dataset to grant access to. |
| GCP.BigQuery.Datasets.access.routine | Unknown | A routine from a different dataset to grant access to. |
| GCP.BigQuery.Datasets.access.dataset | Unknown | A grant authorizing access to this dataset for all resources of a particular type. |
| GCP.BigQuery.Datasets.access.condition | Unknown | The binding condition. |
| GCP.BigQuery.Datasets.creationTime | String | The time since the epoch the dataset was created, in milliseconds. |
| GCP.BigQuery.Datasets.lastModifiedTime | String | The time since the epoch the dataset was last modified, in milliseconds. |
| GCP.BigQuery.Datasets.location | String | The geographic location where the dataset resides. |
| GCP.BigQuery.Datasets.defaultEncryptionConfiguration | String | The default encryption configuration for all tables in the dataset. |
| GCP.BigQuery.Datasets.type | String | The type of the dataset. |
| GCP.BigQuery.Datasets.linkedDatasetSource | Unknown | The source dataset reference when the dataset is of type LINKED. |
| GCP.BigQuery.Datasets.linkedDatasetMetadata | Unknown | Metadata about the LinkedDataset. |
| GCP.BigQuery.Datasets.externalDatasetReference | Unknown | Reference to a read-only external dataset defined in data catalogs outside of BigQuery. |
| GCP.BigQuery.Datasets.externalCatalogDatasetOptions | Unknown | Options defining open source compatible datasets in the BigQuery catalog. Contains metadata of the open source database, schema, or namespace of the current dataset. |
| GCP.BigQuery.Datasets.isCaseInsensitive | String | True if the dataset and its table names are case-insensitive. |
| GCP.BigQuery.Datasets.defaultCollation | String | The default collation specification of future tables created in the dataset. |
| GCP.BigQuery.Datasets.defaultRoundingMode | String | The default rounding mode specification of new tables created within this dataset. |
| GCP.BigQuery.Datasets.maxTimeTravelHours | String | The time travel window in hours. |
| GCP.BigQuery.Datasets.resourceTags | String | The tags attached to this dataset. |
| GCP.BigQuery.Datasets.storageBillingModel | String | The billing model that will be applied to the dataset. |
| GCP.BigQuery.Datasets.catalogSource | String | The origin of the dataset. |
Configuration parameters
credentials— (required)project_id— GCP Project IDproxy— Use system proxy settingsinsecure— Trust any certificate (not secure)
Commands (45)
-
gcp-bq-dataset-policy-removeRemoves an email from the BigQuery dataset policy. Required Permissions: bigquery.datasets.update, bigquery.datasets.get, bigquery.datasets.getIamPolicy, bigquery.datasets.setIamPolicy.
-
gcp-compute-enable-private-ip-access-on-subnet-quick-actionEnables Private Google Access on a GCP subnet. Required permissions: compute.subnetworks.setPrivateIpGoogleAccess, compute.subnetworks.update, compute.subnetworks.get, compute.subnetworks.list.
-
gcp-compute-firewall-getRetrieves a specific firewall rule by name. Required permission: compute.firewalls.get.
-
gcp-compute-firewall-insertCreates a new firewall rule in a specific project. Required permission: compute.firewalls.create.
-
gcp-compute-firewall-listLists the firewall rules in a specific project. Required permission: compute.firewalls.list.
-
gcp-compute-firewall-patchUpdates a specific firewall rule with the data included in the request. Required permissions: compute.firewalls.update, compute.firewalls.get, compute.firewalls.list, compute.networks.updatePolicy, compute.networks.list.
-
gcp-compute-firewall-patch-disable-gcp-default-firewall-rule-quick-actionDisables a default GCP firewall rule that is overly permissive (except HTTP and HTTPS). Required permissions: compute.firewalls.update, compute.firewalls.get, compute.firewalls.list, compute.networks.updatePolicy, compute.networks.list.
-
gcp-compute-image-getReturns a specific image. Required permission: compute.images.get.
-
gcp-compute-instance-getReturns a specific instance resource. To get a list of available instances, make a list() request. Required permission: compute.instances.get.
-
gcp-compute-instance-group-getReturns a specific instance group. Required permission: compute.instanceGroups.get.
-
gcp-compute-instance-labels-setSets labels on an instance. Required permission: compute.instances.setLabels.
-
gcp-compute-instance-service-account-removeRemoves the service account associated with a GCP Compute Engine VM instance. The instance must be stopped before the service account can be changed. Required permissions: compute.instances.setServiceAccount, compute.instances.get.
-
gcp-compute-instance-service-account-setSets the service account for a GCP Compute Engine VM instance. The instance must be stopped before the service account can be changed. Required permissions: compute.instances.setServiceAccount, compute.instances.get.
-
gcp-compute-instance-startStarts an instance that was stopped using the instances().stop method. Required permission: compute.instances.start.
-
gcp-compute-instance-stopStops and cleanly shuts down a running instance, allowing you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using such as persistent disks and static IP addresses will continue to be charged until they are deleted. Required permission: compute.instances.stop.
-
gcp-compute-instances-aggregated-list-by-ipReturns an aggregated list of instances across all zones that can be filtered by internal or external IP. Required permission: cloudasset.assets.searchAllResources.
-
gcp-compute-instances-listRetrieves the list of instances in the specified zone. Required permission: compute.instances.list.
-
gcp-compute-network-getReturns the specified network.
-
gcp-compute-network-insertCreates a network in the specified project using the data included in the request. Required permission: compute.networks.create.
-
gcp-compute-network-tag-setAdds a network tag to a VM instance (merges with existing tags). Required permission: compute.instances.setTags.
-
gcp-compute-networks-listRetrieves a list of networks available for the specified project. Required permission: compute.networks.list.
-
gcp-compute-region-getReturns a specific region resource. Required permission: compute.regions.get.
-
gcp-compute-snapshot-getRetrieves details for a specific snapshot. Required permission: compute.snapshots.get.
-
gcp-compute-snapshots-listLists snapshots in a specific project. Required permission: compute.snapshots.list.
-
gcp-compute-subnet-updateEnables flow logs or Private Google Access on a subnet. Required permissions: compute.subnetworks.setPrivateIpGoogleAccess, compute.subnetworks.update, compute.subnetworks.get, compute.subnetworks.list.
-
gcp-compute-subnet-update-enable-gcp-subnet-flow-logs-quick-actionEnables VPC Flow Logs on a GCP subnet. Required permissions: compute.subnetworks.setPrivateIpGoogleAccess, compute.subnetworks.update, compute.subnetworks.get, compute.subnetworks.list.
-
gcp-compute-zone-getReturns a specific zone resource. Required permission: compute.zones.get.
-
gcp-container-cluster-security-updateConfigures security settings for GKE clusters, including access controls and visibility. Required permissions: container.clusters.update, container.clusters.get, container.clusters.list.
-
gcp-container-cluster-security-update-enable-gke-cluster-intra-node-visibility-quick-actionEnables intra-node visibility on a GKE cluster for enhanced network monitoring. Required permissions: container.clusters.update, container.clusters.get, container.clusters.list.
-
gcp-container-cluster-security-update-enable-master-authorized-networks-on-gke-quick-actionEnables Master Authorized Networks on a GKE cluster to restrict API server access. Required permissions: container.clusters.update, container.clusters.get, container.clusters.list.
-
gcp-iam-project-policy-binding-removeRemoves a specified IAM role binding from a GCP project. Required permissions: resourcemanager.projects.getIamPolicy, resourcemanager.projects.setIamPolicy.
-
gcp-storage-bucket-getRetrieves information about a specific bucket. Required permission: storage.buckets.get.
-
gcp-storage-bucket-listRetrieves the list of buckets in the project associated with the client. Required permission: storage.buckets.list.
-
gcp-storage-bucket-metadata-updateUpdates Google Cloud Storage (GCS) bucket metadata, including settings such as versioning and Uniform Bucket-Level Access (UBLA). Required permission: storage.buckets.update.
-
gcp-storage-bucket-metadata-update-enable-GCP-bucket-versioning-quick-actionEnables versioning on a GCP storage bucket to preserve object versions. Required permission: storage.buckets.update.
-
gcp-storage-bucket-metadata-update-set-GCP-bucket-access-to-uniform-quick-actionEnables uniform bucket-level access on a GCP storage bucket for enhanced security. Required permission: storage.buckets.update.
-
gcp-storage-bucket-object-policy-listRetrieves the IAM policy for a specific object in a bucket. Required permission: storage.objects.getIamPolicy.
-
gcp-storage-bucket-object-policy-setSets the IAM policy for a specific object in a bucket. Required permission: storage.objects.setIamPolicy.
-
gcp-storage-bucket-objects-listRetrieves the list of objects in a bucket. Required permission: storage.objects.list.
-
gcp-storage-bucket-policy-deleteRemoves an entity from a bucket's Access Control List. Required permissions: storage.buckets.getIamPolicy, storage.buckets.setIamPolicy.
-
gcp-storage-bucket-policy-delete-make-gcp-bucket-private-quick-actionRevokes 'allUsers' and 'allAuthenticatedUsers' permissions access in a GCP storage bucket. Required permissions: storage.buckets.getIamPolicy, storage.buckets.setIamPolicy.
-
gcp-storage-bucket-policy-delete-remove-AllAuthenticatedUser-access-quick-actionRevokes 'allAuthenticatedUsers' permission access in GCP storage buckets. Required permissions: storage.buckets.getIamPolicy, storage.buckets.setIamPolicy.
-
gcp-storage-bucket-policy-delete-remove-allusers-access-quick-actionRevokes 'allUsers' permission access in GCP storage buckets. Required permissions: storage.buckets.getIamPolicy, storage.buckets.setIamPolicy.
-
gcp-storage-bucket-policy-listRetrieves the IAM policy for a bucket. Required permissions: storage.buckets.getIamPolicy, storage.buckets.get.
-
gcp-storage-bucket-policy-setSets the IAM policy for a bucket. Required permission: storage.buckets.setIamPolicy.
from CommonServerPython import * # noqa from CommonServerUserPython import * # noqa from google.oauth2.credentials import Credentials from googleapiclient.discovery import build from google.oauth2 import service_account as google_service_account from google_auth_httplib2 import AuthorizedHttp import httplib2 import urllib.parse import urllib3 from COOCApiModule import * from googleapiclient.errors import HttpError urllib3.disable_warnings() def build_http_client(use_proxy: bool, verify_ssl: bool) -> httplib2.Http: """Builds an httplib2.Http honoring the given proxy and SSL settings. Args: use_proxy (bool): When True, the system proxy (from ``handle_proxy``) is applied. verify_ssl (bool): When False, SSL certificate validation is disabled. Returns: httplib2.Http: A configured HTTP client. """ proxy_info = None proxies = handle_proxy() if use_proxy: https_proxy = proxies.get("https") if not https_proxy: raise DemistoException("https proxy value is empty. Check the Cortex server configuration.") if not https_proxy.startswith(("http://", "https://")): https_proxy = "https://" + https_proxy parsed_proxy = urllib.parse.urlparse(https_proxy) proxy_info = httplib2.ProxyInfo( proxy_type=httplib2.socks.PROXY_TYPE_HTTP, # disable-secrets-detection proxy_host=parsed_proxy.hostname, proxy_port=parsed_proxy.port or (443 if https_proxy.startswith("https://") else 80), proxy_user=parsed_proxy.username, proxy_pass=parsed_proxy.password, ) ca_bundle = os.getenv("REQUESTS_CA_BUNDLE") or os.getenv("SSL_CERT_FILE") if verify_ssl and not ca_bundle: # No environment-provided bundle: httplib2 falls back to its own bundled CA certs. demisto.debug("[GCP] No system CA bundle env var set; httplib2 will use its bundled CA certs.") return httplib2.Http( proxy_info=proxy_info, disable_ssl_certificate_validation=not verify_ssl, ca_certs=ca_bundle, ) class GCPServices(Enum): """ Enumeration of Google Cloud Platform services with API details. Each service contains: - API name: The service name used in Google API client - Version: The API version to use - API endpoint: The full endpoint URL for service enablement checks Example: compute_service = GCPServices.COMPUTE client = compute_service.build(credentials) api_endpoint = compute_service.api_endpoint """ COMPUTE = ("compute", "v1", "compute.googleapis.com") STORAGE = ("storage", "v1", "storage.googleapis.com") CONTAINER = ("container", "v1", "container.googleapis.com") RESOURCE_MANAGER = ("cloudresourcemanager", "v3", "cloudresourcemanager.googleapis.com") BIGQUERY = ("bigquery", "v2", "bigquery.googleapis.com") # The following services are currently unsupported: # IAM_V1 = ("iam", "v1", "iam.googleapis.com") # IAM_V2 = ("iam", "v2", "iam.googleapis.com") # CLOUD_IDENTITY = ("cloudidentity", "v1", "cloudidentity.googleapis.com") def __init__(self, api_name: str, version: str, api_endpoint: str): """ Initialize GCP service configuration. Args: api_name (str): The Google API service name (e.g., 'compute'). version (str): The API version (e.g., 'v1'). api_endpoint (str): The full API endpoint for enablement checks (e.g., 'compute.googleapis.com'). """ self._api_name = api_name self._version = version self._api_endpoint = api_endpoint @property def api_name(self) -> str: """Get the Google API service name.""" return self._api_name @property def version(self) -> str: """Get the API version.""" return self._version @property def api_endpoint(self) -> str: """Get the full API endpoint for service enablement checks.""" return self._api_endpoint def build(self, credentials, **kwargs): """ Build a Google API client for this service. On the marketplace path (Cortex XSOAR / Cortex XSIAM < 3.0) the credentials are always wrapped in an ``AuthorizedHttp`` over a custom ``httplib2.Http`` transport so the user's *Use system proxy settings* and *Trust any certificate (not secure)* options are actually enforced (e.g. SSL verification fails when no CA is configured and the box is left unchecked). On the Cortex Platform path connectivity is handled by the platform, so the Google client's standard transport is used. Args: credentials: Google Cloud credentials object. **kwargs: Additional arguments passed to the Google API client builder. Returns: Google API client instance for this service. """ # Marketplace path (no connector ID): manage our own transport so the proxy/SSL # params are honored. Platform path: use the Google client's standard transport. if not get_connector_id() and "http" not in kwargs: params = demisto.params() use_proxy = params.get("proxy", False) verify_ssl = not argToBoolean(params.get("insecure", False)) http = build_http_client(use_proxy=use_proxy, verify_ssl=verify_ssl) kwargs["http"] = AuthorizedHttp(credentials, http=http) return build(self.api_name, self.version, **kwargs) return build(self.api_name, self.version, credentials=credentials, **kwargs) def test_connectivity(self, credentials, project_id: str) -> None: """Issues a lightweight, project-scoped API call to verify connectivity to this service. Resource Manager uses ``testIamPermissions``, which succeeds for any authenticated caller regardless of the roles granted (it returns the subset of granted permissions), making it a permission-agnostic probe. The other services do not expose a project-level ``testIamPermissions``, so a minimal ``list`` call is used instead. Each service exposes the call on a different resource, so the correct shape is selected per service. The call is allowed to raise so callers can inspect the error (e.g. distinguish a disabled-API 403 from a real failure). Use ``test_all_services`` for a non-raising, tuple-based summary. Args: credentials: Google Cloud credentials object. project_id: The GCP project ID to test against. Raises: HttpError: If the API call fails (e.g. the service's API is disabled). NotImplementedError: If the service does not have a connectivity probe defined here. """ client = self.build(credentials) if self == GCPServices.RESOURCE_MANAGER: client.projects().testIamPermissions( # pylint: disable=E1101 resource=f"projects/{project_id}", body={"permissions": ["resourcemanager.projects.get"]} ).execute() elif self == GCPServices.COMPUTE: # Compute has no project-level testIamPermissions; a minimal firewalls list verifies connectivity. client.firewalls().list(project=project_id, maxResults=1).execute() # pylint: disable=E1101 elif self == GCPServices.STORAGE: # Storage has no project-level testIamPermissions; a minimal bucket list verifies connectivity. client.buckets().list(project=project_id, maxResults=1).execute() # pylint: disable=E1101 elif self == GCPServices.CONTAINER: # Container has no testIamPermissions; a lightweight cluster list verifies connectivity. client.projects().locations().clusters().list( # pylint: disable=E1101 parent=f"projects/{project_id}/locations/-" ).execute() elif self == GCPServices.BIGQUERY: # BigQuery has no project-level testIamPermissions; a lightweight dataset list verifies connectivity. client.datasets().list(projectId=project_id, maxResults=1).execute() # pylint: disable=E1101 else: raise NotImplementedError(f"No connectivity probe defined for service {self.api_name}") @classmethod def test_all_services(cls, credentials, project_id: str) -> list[tuple[str, bool, str]]: """ Test connectivity for all GCP services with real API calls. Wraps the raising ``test_connectivity`` per service into a non-raising summary so the health check can report per-service results. Args: credentials: Google Cloud credentials object. project_id: The GCP project ID to test against. Returns: list[tuple[str, bool, str]]: List of (service_name, success, error_message) for each service. """ results = [] for service in cls: try: service.test_connectivity(credentials, project_id) results.append((service.api_name, True, "")) except Exception as e: results.append((service.api_name, False, str(e))) return results # Command requirements mapping: (GCP_Service_Enum, [Required_Permissions]) COMMAND_REQUIREMENTS: dict[str, tuple[GCPServices, list[str]]] = { "gcp-compute-firewall-patch": ( GCPServices.COMPUTE, [ "compute.firewalls.update", "compute.firewalls.get", "compute.firewalls.list", "compute.networks.updatePolicy", "compute.networks.list", ], ), "gcp-compute-firewall-insert": ( GCPServices.COMPUTE, [ "compute.firewalls.create", ], ), "gcp-compute-firewall-list": ( GCPServices.COMPUTE, [ "compute.firewalls.list", ], ), "gcp-compute-firewall-get": ( GCPServices.COMPUTE, [ "compute.firewalls.get", ], ), "gcp-compute-snapshots-list": ( GCPServices.COMPUTE, [ "compute.snapshots.list", ], ), "gcp-compute-snapshot-get": ( GCPServices.COMPUTE, [ "compute.snapshots.get", ], ), "gcp-compute-instances-aggregated-list-by-ip": ( GCPServices.COMPUTE, [ "cloudasset.assets.searchAllResources", ], ), "gcp-compute-network-tag-set": ( GCPServices.COMPUTE, [ "compute.instances.setTags", ], ), "gcp-compute-subnet-update": ( GCPServices.COMPUTE, [ "compute.subnetworks.setPrivateIpGoogleAccess", "compute.subnetworks.update", "compute.subnetworks.get", "compute.subnetworks.list", ], ), "gcp-compute-instance-service-account-set": ( GCPServices.COMPUTE, ["compute.instances.setServiceAccount", "compute.instances.get"], ), "gcp-compute-instance-service-account-remove": ( GCPServices.COMPUTE, ["compute.instances.setServiceAccount", "compute.instances.get"], ), "gcp-compute-instance-start": (GCPServices.COMPUTE, ["compute.instances.start"]), "gcp-compute-instance-stop": (GCPServices.COMPUTE, ["compute.instances.stop"]), "gcp-compute-instances-list": (GCPServices.COMPUTE, ["compute.instances.list"]), "gcp-compute-instance-get": (GCPServices.COMPUTE, ["compute.instances.get"]), "gcp-compute-instance-labels-set": (GCPServices.COMPUTE, ["compute.instances.setLabels"]), "gcp-storage-bucket-policy-delete": (GCPServices.STORAGE, ["storage.buckets.getIamPolicy", "storage.buckets.setIamPolicy"]), "gcp-storage-bucket-metadata-update": (GCPServices.STORAGE, ["storage.buckets.update"]), "gcp-storage-bucket-list": ( GCPServices.STORAGE, ["storage.buckets.list"], ), "gcp-storage-bucket-get": ( GCPServices.STORAGE, ["storage.buckets.get"], ), "gcp-storage-bucket-objects-list": ( GCPServices.STORAGE, ["storage.objects.list"], ), "gcp-storage-bucket-policy-list": ( GCPServices.STORAGE, ["storage.buckets.getIamPolicy", "storage.buckets.get"], ), "gcp-storage-bucket-policy-set": ( GCPServices.STORAGE, ["storage.buckets.setIamPolicy"], ), "gcp-storage-bucket-object-policy-list": ( GCPServices.STORAGE, ["storage.objects.getIamPolicy"], ), "gcp-storage-bucket-object-policy-set": ( GCPServices.STORAGE, ["storage.objects.setIamPolicy"], ), "gcp-compute-network-get": (GCPServices.COMPUTE, ["compute.networks.get"]), "gcp-compute-image-get": (GCPServices.COMPUTE, ["compute.images.get"]), "gcp-compute-instance-group-get": (GCPServices.COMPUTE, ["compute.instanceGroups.get"]), "gcp-compute-region-get": (GCPServices.COMPUTE, ["compute.regions.get"]), "gcp-compute-zone-get": (GCPServices.COMPUTE, ["compute.zones.get"]), "gcp-compute-networks-list": (GCPServices.COMPUTE, ["compute.networks.list"]), "gcp-compute-network-insert": (GCPServices.COMPUTE, ["compute.networks.create"]), "gcp-container-cluster-security-update": ( GCPServices.CONTAINER, ["container.clusters.update", "container.clusters.get", "container.clusters.list"], ), "gcp-bq-dataset-policy-remove": ( GCPServices.BIGQUERY, ["bigquery.datasets.update", "bigquery.datasets.get", "bigquery.datasets.getIamPolicy", "bigquery.datasets.setIamPolicy"], ), "gcp-iam-project-policy-binding-remove": ( GCPServices.RESOURCE_MANAGER, ["resourcemanager.projects.getIamPolicy", "resourcemanager.projects.setIamPolicy"], ), # The following commands are currently unsupported: # "gcp-compute-instance-metadata-add": ( # GCPServices.COMPUTE, # ["compute.instances.setMetadata", "compute.instances.get", "compute.instances.list", "iam.serviceAccounts.actAs"], # ), # "gcp-iam-project-deny-policy-create": ( # GCPServices.IAM_V2, # ["iam.denypolicies.create"] # ), # "gcp-iam-service-account-delete": ( # GCPServices.IAM_V1, # ["iam.serviceAccounts.delete"] # ), # "gcp-iam-group-membership-delete": ( # GCPServices.CLOUD_IDENTITY, # ["cloudidentity.groups.memberships.delete"] # ), } OPERATION_TABLE = ["id", "kind", "name", "operationType", "progress", "zone", "status"] # taken from GoogleCloudCompute FIREWALL_RULE_REGEX = re.compile(r"ipprotocol=([\w\d_:.-]+),ports=([ /\w\d@_,.\*-]+)", flags=re.I) KEY_VALUE_ITEM_REGEX = re.compile(r"key=([\w\d_:.-]+),value=([ /\w\d@_,.\*-]+)", flags=re.I) def parse_firewall_rule(rule_str: str) -> list[dict[str, list[str] | str]]: """ Transforms a string of firewall rules into a list of dictionaries. Args: rule_str (str): A semicolon-separated string of firewall rules, e.g., "ipprotocol=abc,ports=123;ipprotocol=ded,ports=22,443". Returns: list[dict[str, list[str] | str]]: A list of dictionaries containing 'IPProtocol' and 'ports'. """ rules = [] for f in rule_str.split(";"): match = FIREWALL_RULE_REGEX.match(f) if match is None: raise ValueError( f"Could not parse field: {f}. Please make sure you provided like so: " "ipprotocol=abc,ports=123;ipprotocol=fed,ports=456" ) rules.append({"IPProtocol": match.group(1), "ports": match.group(2).split(",")}) return rules def parse_metadata_items(tags_str: str) -> list[dict[str, str]]: """ Transforms a string of metadata items into a list of dictionaries. Args: tags_str (str): A semicolon-separated string of metadata items, e.g., "key=abc,value=123;key=fed,value=456". Returns: list[dict[str, str]]: A list of dictionaries containing 'key' and 'value' pairs. """ tags = [] for f in tags_str.split(";"): match = KEY_VALUE_ITEM_REGEX.match(f) if match is None: raise ValueError( f"Could not parse field: {f}. Please make sure you provided like so: key=abc,value=123;key=fed,value=456" ) tags.append({"key": match.group(1), "value": match.group(2)}) return tags def extract_zone_name(zone_input: str | None) -> str: """ Extracts the GCP zone name from a full URL or returns it directly if already a zone string. Args: zone_input (str): The zone string or full GCP zone URL. Returns: str: The zone name, e.g., "us-central1-b". https://www.googleapis.com/compute/v1/projects/test/zones/us-central1-b -> us-central1-b Raises: DemistoException: If the zone input is empty or invalid. """ if not zone_input or not zone_input.strip(): raise DemistoException("The zone argument cannot be empty") if "/" in zone_input: return zone_input.strip().split("/")[-1] return zone_input.strip() def parse_labels(labels_str: str) -> dict: """ Transforms a string of multiple inputs to a dictionary Args: labels_str (str): The actual string to parse to a key & value pair. Returns: Returns the labels dictionary with the extracted key & value pairs. """ labels = {} for f in labels_str.strip().split(";"): if f: match = KEY_VALUE_ITEM_REGEX.match(f) if match is None: raise ValueError( f"Could not parse field: {f}. Please make sure you provided like so: key=abc,value=123;key=def,value=456" ) labels.update({match.group(1).lower(): match.group(2).lower()}) return labels def handle_permission_error(e: HttpError, project_id: str, command_name: str): """ Given an error, extract the relevant information (account_id & message & permission name) to report to the backend. Args: e (HttpError): The error object. project_id (str): The project identifier. command_name (str): The name of the command that was executed. Returns: Returns the labels dictionary with the extracted key & value pairs. """ status_code = e.resp.status if int(status_code) in [403, 401] and e.resp.get("content-type", "").startswith("application/json"): message_content = json.loads(e.content) error_message = message_content.get("error", {}).get("message", "") # get the relevant permissions for the relevant command command_permissions: list[str] command_permissions = COMMAND_REQUIREMENTS[command_name][1] # find out which permissions are relevant for the current execution failure from the list of command permissions. found_permissions = [perm for perm in command_permissions if perm.lower() in error_message.lower()] or ["N/A"] demisto.debug(f"The info {error_message=} {found_permissions=} {message_content=}") # create an error entry for each missing permission. error_entries = [{"account_id": project_id, "message": error_message, "name": perm} for perm in found_permissions] return_multiple_permissions_error(error_entries) else: # Return the original error if it's not a 403, 401 or doesn't have a JSON body return_error(f"Failed to execute command {demisto.command()}. Error: {str(e)}") def _format_gcp_datetime(ts: str | None) -> str | None: if not ts: return None dt = datetime.fromisoformat(ts.replace("Z", "+00:00")) return dt.strftime("%Y-%m-%d %H:%M:%S") def _is_ubla_enabled(storage_client, bucket_name: str) -> bool: """Returns True if Uniform Bucket-Level Access (UBLA) is enabled for the bucket.""" try: meta = storage_client.buckets().get(bucket=bucket_name, fields="iamConfiguration").execute() # pylint: disable=E1101 return meta.get("iamConfiguration", {}).get("uniformBucketLevelAccess", {}).get("enabled") is True except Exception as e: demisto.debug(f"_is_ubla_enabled: failed to fetch bucket metadata for {bucket_name}: {e}") return False def _is_ubla_error(e: HttpError) -> bool: """Detects UBLA-related 400 error content from Google API.""" try: if isinstance(e.content, bytes | bytearray): content_lower = e.content.decode("utf-8", errors="ignore").lower() else: content_lower = str(e.content).lower() except Exception: content_lower = "" return e.resp.status == 400 and "uniform bucket-level access" in content_lower def _is_service_disabled_error(e: HttpError) -> bool: """Detects a 403 SERVICE_DISABLED error from Google API. This is raised when the service's API has not been enabled on the project, so the connectivity probe should move on to another service rather than fail the test. """ try: if isinstance(e.content, bytes | bytearray): content_lower = e.content.decode("utf-8", errors="ignore").lower() else: content_lower = str(e.content).lower() except Exception: content_lower = "" return e.resp.status == 403 and ("service_disabled" in content_lower or "has not been used in project" in content_lower) def _validate_bucket_policy_for_set(policy: dict[str, Any], add_mode: bool) -> None: """Validate the structure of a bucket IAM policy for set operation. Args: policy: The JSON-decoded policy payload provided by the user. add_mode: If True, we only require valid bindings for merge; if False, validate full policy fields where applicable. Raises: DemistoException: If validation fails. """ if not isinstance(policy, dict): raise DemistoException("Policy must be a JSON object.") bindings = policy.get("bindings") if bindings is not None and (not isinstance(bindings, list) or any(not isinstance(b, dict) for b in bindings)): if add_mode: raise DemistoException("Policy must include 'bindings' as an array of objects when add=true.") else: raise DemistoException("'bindings' must be an array of objects if provided.") if isinstance(bindings, list): for idx, b in enumerate(bindings): role = b.get("role") if not isinstance(role, str) or not role: raise DemistoException(f"Binding at index {idx} is missing a valid 'role' string.") members = b.get("members", []) if not isinstance(members, list) or any(not isinstance(m, str) for m in members): raise DemistoException(f"Binding at index {idx} must include 'members' as an array of strings.") if "condition" in b: version = policy.get("version", 1) if not isinstance(version, int) or version < 3: raise DemistoException("Policy with IAM Conditions requires 'version' to be 3 or greater.") ########## def compute_firewall_patch(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Disables a firewall rule in a GCP project. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id' and 'resource_name'. Returns: CommandResults: Result of the firewall patch operation. """ project_id = args.get("project_id") resource_name = args.get("resource_name") config = {} if description := args.get("description"): config["description"] = description if network := args.get("network"): config["network"] = network if priority := args.get("priority"): config["priority"] = priority if sourceRanges := args.get("sourceRanges"): config["sourceRanges"] = argToList(sourceRanges) if destinationRanges := args.get("destinationRanges"): config["destinationRanges"] = destinationRanges if sourceTags := args.get("sourceTags"): config["sourceTags"] = argToList(sourceTags) if targetTags := args.get("targetTags"): config["targetTags"] = argToList(targetTags) if sourceServiceAccounts := args.get("sourceServiceAccounts"): config["sourceServiceAccounts"] = argToList(sourceServiceAccounts) if targetServiceAccounts := args.get("targetServiceAccounts"): config["targetServiceAccounts"] = argToList(targetServiceAccounts) if allowed := args.get("allowed"): config["allowed"] = parse_firewall_rule(allowed) if denied := args.get("denied"): config["denied"] = parse_firewall_rule(denied) if direction := args.get("direction"): config["direction"] = direction if logConfigEnable := args.get("logConfigEnable"): config["logConfig"] = {"enable": argToBoolean(logConfigEnable)} if disabled := args.get("disabled"): config["disabled"] = argToBoolean(disabled) compute = GCPServices.COMPUTE.build(creds) demisto.debug(f"Firewall patch config for {resource_name} in project {project_id}: {config}") response = ( compute.firewalls() # pylint: disable=E1101 .patch(project=project_id, firewall=resource_name, body=config) .execute() ) hr = tableToMarkdown( "Google Cloud Compute Firewall Rule Update Operation Started Successfully", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) def storage_bucket_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves the list of buckets in the project associated with the client. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Command arguments including optional project_id, max_results, prefix, page_token. Returns: CommandResults: List of buckets with their metadata. """ project_id = args.get("project_id") max_results = arg_to_number(args.get("limit")) prefix = args.get("prefix") page_token = args.get("page_token") demisto.debug(f"[GCP: storage_bucket_list] \nMax results: {max_results}, \nPrefix: {prefix}, \nPage token: {page_token}") storage = GCPServices.STORAGE.build(creds) # Build request parameters request_params = {"project": project_id, "maxResults": max_results, "prefix": prefix, "pageToken": page_token} remove_nulls_from_dictionary(request_params) demisto.debug(f"[GCP: storage_bucket_list] Request params: {request_params}") response = storage.buckets().list(**request_params).execute() # pylint: disable=E1101 buckets = response.get("items", []) demisto.debug(f"[GCP: storage_bucket_list] Buckets returned: {len(buckets)}") hr_bucket_data: list[dict[str, Any]] = [] for bucket in buckets: hr_bucket_data.append( { "Name": bucket.get("name"), "TimeCreated": _format_gcp_datetime(bucket.get("timeCreated")), "TimeUpdated": _format_gcp_datetime(bucket.get("updated")), "OwnerID": bucket.get("owner", {}).get("entityId", ""), "Location": bucket.get("location"), "StorageClass": bucket.get("storageClass"), } ) hr = tableToMarkdown("GCP Storage Buckets", hr_bucket_data, removeNull=True, headerTransform=pascalToSpace) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.Bucket", outputs=buckets, outputs_key_field=["name", "id"], raw_response=buckets, ) def storage_bucket_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves information about a specific bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Command arguments including required bucket_name. Returns: CommandResults: Bucket information. """ bucket_name = args.get("bucket_name", "") storage = GCPServices.STORAGE.build(creds) response = storage.buckets().get(bucket=bucket_name).execute() # pylint: disable=E1101 demisto.debug(f"[GCP: storage_bucket_get] \nResponse: \n{response}") bucket_info = { "Name": response.get("name"), "TimeCreated": _format_gcp_datetime(response.get("timeCreated")), "TimeUpdated": _format_gcp_datetime(response.get("updated")), "OwnerID": response.get("owner", {}).get("entityId", ""), "Location": response.get("location"), "StorageClass": response.get("storageClass"), } hr = tableToMarkdown(f"GCP Storage Bucket: {bucket_name}", bucket_info, removeNull=True, headerTransform=pascalToSpace) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.Bucket", outputs=response, outputs_key_field=["name", "id"], raw_response=response, ) def storage_bucket_objects_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves the list of objects in a bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Command arguments including required bucket_name and optional filters. Returns: CommandResults: List of objects in the bucket. """ bucket_name = args.get("bucket_name", "") prefix = args.get("prefix", "") delimiter = args.get("delimiter", "") max_results = arg_to_number(args.get("limit")) page_token = args.get("page_token", "") storage = GCPServices.STORAGE.build(creds) # Build request parameters request_params = { "bucket": bucket_name, "prefix": prefix, "delimiter": delimiter, "maxResults": max_results, "pageToken": page_token, } remove_nulls_from_dictionary(request_params) demisto.debug(f"[GCP: storage_bucket_objects_list] Request params: {request_params}") response = storage.objects().list(**request_params).execute() # pylint: disable=E1101 demisto.debug(f" \nResponse: \n{response}") objects = response.get("items", []) demisto.debug(f"[GCP: storage_bucket_objects_list] Objects returned: {len(objects)}") object_data: list[dict[str, Any]] = [] for obj in objects: object_info = { "Name": obj.get("name", ""), "Bucket": obj.get("bucket", ""), "ContentType": obj.get("contentType", ""), "Size": obj.get("size", ""), "TimeCreated": _format_gcp_datetime(obj.get("timeCreated", "")), "TimeUpdated": _format_gcp_datetime(obj.get("updated", "")), "MD5Hash": obj.get("md5Hash", ""), "CRC32c": obj.get("crc32c", ""), } object_data.append(object_info) hr = tableToMarkdown(f"Objects in bucket: {bucket_name}", object_data, removeNull=True, headerTransform=pascalToSpace) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.BucketObject", outputs=objects, outputs_key_field=["name", "id"], raw_response=objects, ) def storage_bucket_policy_list( creds: Credentials, args: dict[str, Any], outputs_prefix: str = "GCP.Storage.BucketPolicy", object_name: str = "", ) -> CommandResults: """ Retrieves the IAM policy for a bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Command arguments including required bucket_name and optional requested_policy_version. Returns: CommandResults: IAM policy for the bucket. """ bucket_name = args.get("bucket_name", "") requested_policy_version = arg_to_number(args.get("requested_policy_version")) storage = GCPServices.STORAGE.build(creds) # Build request parameters request_params = { "bucket": bucket_name, "optionsRequestedPolicyVersion": requested_policy_version, } remove_nulls_from_dictionary(request_params) demisto.debug(f"[GCP: storage_bucket_policy_list] Request params: {request_params}") response = storage.buckets().getIamPolicy(**request_params).execute() # pylint: disable=E1101 policy_summary = { "Bucket": bucket_name, "Version": response.get("version"), "ETag": response.get("etag"), "Bindings count": len(response.get("bindings", [])), } bindings_rows = [] for binding in response.get("bindings", []): role = binding.get("role", "") members = binding.get("members", []) bindings_rows.append({"Role": role, "Members": "\n".join(members) if members else ""}) summary_object_type = f"bucket: {bucket_name}" outputs = response primary_key: str | list[str] = "resourceId" # Build outputs for object policy command if object_name: summary_object_type = f"object: {object_name}" outputs = {"bucketName": bucket_name, "objectName": object_name, "bindings": response.get("bindings", [])} primary_key = ["bucketName", "objectName"] summary_text = ( f"IAM Policy for {summary_object_type}\n Version: {policy_summary['Version']}\n" f"ETag: {policy_summary['ETag']}\n Bindings count: {policy_summary['Bindings count']}" ) hr_bindings = tableToMarkdown( "Bindings", bindings_rows, headers=["Role", "Members"], removeNull=True, headerTransform=pascalToSpace, ) demisto.debug(f"[GCP: storage_bucket_policy_list] Bindings count: {len(bindings_rows)}") hr = f"{summary_text}\n\n{hr_bindings}" return CommandResults( readable_output=hr, outputs_prefix=outputs_prefix, outputs=outputs, raw_response=response, outputs_key_field=primary_key, ) def storage_bucket_policy_set(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Sets the IAM policy for a bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Command arguments including required bucket_name and policy. Returns: CommandResults: Result of the policy update operation. """ bucket_name = args.get("bucket_name", "") policy_json = args.get("policy", {}) try: policy = json.loads(policy_json) except json.JSONDecodeError as e: raise DemistoException(f"Invalid JSON format for policy: {str(e)}") storage = GCPServices.STORAGE.build(creds) demisto.debug(f"[GCP: storage_bucket_policy_set] Bucket: {bucket_name}; Policy keys: {list(policy.keys())}") add_flag = argToBoolean(args.get("add")) _validate_bucket_policy_for_set(policy=policy, add_mode=add_flag) if add_flag: current = storage.buckets().getIamPolicy(bucket=bucket_name).execute() # pylint: disable=E1101 current_bindings: list[dict] = current.get("bindings", []) provided_bindings: list[dict] = policy.get("bindings", []) # Index current bindings by role by_role: dict[str, dict] = { str(b.get("role")): {"role": b.get("role"), "members": set(b.get("members", []))} for b in current_bindings if b.get("role") } # Merge provided bindings for pb in provided_bindings: role = pb.get("role") members = set(pb.get("members", []) or []) if not role: continue if role in by_role: by_role[role]["members"].update(members) else: by_role[role] = {"role": role, "members": set(members)} # Build merged bindings list merged_bindings = [{"role": r, "members": sorted(data["members"])} for r, data in by_role.items()] # Preserve other top-level fields from current policy if present (e.g., etag/version) merged_policy = dict(current) merged_policy["bindings"] = merged_bindings response = storage.buckets().setIamPolicy(bucket=bucket_name, body=merged_policy).execute() # pylint: disable=E1101 else: response = storage.buckets().setIamPolicy(bucket=bucket_name, body=policy).execute() # pylint: disable=E1101 demisto.debug(f" \nResponse: \n{response}") result_info = {"Bucket": bucket_name, "PolicyUpdatedSuccessfully": True, "NewPolicyVersion": response.get("version")} hr = tableToMarkdown( f"IAM Policy updated for bucket: {bucket_name}", result_info, removeNull=True, headerTransform=pascalToSpace, ) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.BucketPolicy", outputs=response, outputs_key_field="etag", raw_response=response, ) def storage_bucket_object_policy_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Lists object-level ACLs for a specific object using the GCS ObjectAccessControls API. If Uniform Bucket-Level Access (UBLA) is enabled on the bucket, object-level ACLs are disabled and the command returns the bucket-level IAM policy instead for guidance. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): - bucket_name (str): Target bucket name. - object_name (str): Target object name. - generation (Number, optional): Object generation to target when listing ACLs. Returns: CommandResults: Human-readable table of ACL entries and machine outputs under 'GCP.Storage.BucketObjectPolicy'. """ bucket_name = args.get("bucket_name", "") object_name = args.get("object_name", "") generation = arg_to_number(args.get("generation")) storage = GCPServices.STORAGE.build(creds) # UBLA short-circuit if _is_ubla_enabled(storage, bucket_name): demisto.debug(f"Uniform Bucket-Level Access is enabled for {bucket_name} bucket. return the bucket policy") return storage_bucket_policy_list( creds=creds, args=args, outputs_prefix="GCP.Storage.BucketObjectPolicy", object_name=object_name, ) # Build request parameters request_params = {"bucket": bucket_name, "object": object_name, "generation": generation} remove_nulls_from_dictionary(request_params) demisto.debug(f"[GCP: storage_bucket_object_policy_list] Request params: {request_params}") try: response = ( storage.objectAccessControls() # pylint: disable=E1101 .list(bucket=bucket_name, object=object_name) .execute() ) except HttpError as e: if _is_ubla_error(e): demisto.debug(f"Uniform Bucket-Level Access is enabled for {bucket_name} bucket. return the bucket policy") return storage_bucket_policy_list( creds=creds, args=args, outputs_prefix="GCP.Storage.BucketObjectPolicy", object_name=object_name, ) demisto.debug(f"[GCP: storage_bucket_object_policy_get] HttpError status={getattr(e.resp, 'status', None)}") raise # Build human readable output: summary + bindings table items = response.get("items", []) hr = tableToMarkdown(f"Policy for object: {object_name} in bucket: {bucket_name}", items, headerTransform=pascalToSpace) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.BucketObjectPolicy", outputs=items, raw_response=response, outputs_key_field=["Bucket", "Key"], ) def storage_bucket_object_policy_set(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Sets object-level ACLs using the GCS ObjectAccessControls API. This command applies one or more ACL entries to a specific object. For each provided entry (with fields like 'entity' and 'role'), it attempts an idempotent update first and falls back to insert if the ACL entry does not exist. If Uniform Bucket-Level Access (UBLA) is enabled on the bucket, object-level ACLs are not permitted and the command returns guidance to use bucket-level IAM instead. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): - bucket_name (str): Target bucket name. - object_name (str): Target object name. - policy (JSON str): A single ACL object or a JSON array of ACL objects. Each object must include 'entity' and 'role' (e.g., {"entity": "allUsers", "role": "READER"}). - generation (Number, optional): Object generation to target. Returns: CommandResults: Human-readable table of applied ACL entries and machine outputs under 'GCP.Storage.BucketObjectPolicy'. """ bucket_name = args.get("bucket_name", "") object_name = args.get("object_name", "") policy_json = args.get("policy", {}) generation = arg_to_number(args.get("generation")) try: policy = json.loads(policy_json) except json.JSONDecodeError as e: raise DemistoException(f"Invalid JSON format for policy: {str(e)}") storage = GCPServices.STORAGE.build(creds) # UBLA short-circuit ubla_message = f"""Uniform Bucket-Level Access (UBLA) is enabled for the bucket: {bucket_name}. Use `gcp-storage-bucket-policy-set` at the bucket level instead.""" if _is_ubla_enabled(storage, bucket_name): return CommandResults(readable_output=ubla_message) # Interpret policy as one or many ObjectAccessControls entries entries: list[dict[str, Any]] if isinstance(policy, list): entries = policy elif isinstance(policy, dict): entries = [policy] else: raise DemistoException("'policy' must be a JSON object or an array of objects representing ACL entries.") results: list[dict[str, Any]] = [] for idx, entry in enumerate(entries): entity = entry.get("entity") role = entry.get("role") if not entity or not role: raise DemistoException("Each ACL entry must include 'entity' and 'role'.") # Try update first (idempotent). If it doesn't exist, fallback to insert. update_params = {"bucket": bucket_name, "object": object_name, "entity": entity, "body": entry, "generation": generation} remove_nulls_from_dictionary(update_params) try: demisto.debug(f"[GCP: storage_bucket_object_policy_set] Updating ACL #{idx+1} for entity {entity}") resp = storage.objectAccessControls().patch(**update_params).execute() # pylint: disable=E1101 results.append(resp) continue except Exception as e: # If update fails (e.g., 404), attempt insert. If UBLA error detected, short-circuit. if isinstance(e, HttpError) and _is_ubla_error(e): return CommandResults(readable_output=ubla_message) demisto.debug(f"[GCP: storage_bucket_object_policy_set] Update failed for entity {entity}: {e}. Trying insert.") try: insert_params = {"bucket": bucket_name, "object": object_name, "body": entry, "generation": generation} remove_nulls_from_dictionary(insert_params) resp = storage.objectAccessControls().insert(**insert_params).execute() # pylint: disable=E1101 results.append(resp) except Exception as ie: if isinstance(ie, HttpError) and _is_ubla_error(ie): return CommandResults(readable_output=ubla_message) raise hr = tableToMarkdown( f"Object ACLs set for object: {object_name} in bucket: {bucket_name}", results if results else [{"message": "No ACL changes applied"}], removeNull=True, headerTransform=pascalToSpace, ) return CommandResults( readable_output=hr, outputs_prefix="GCP.Storage.BucketObjectPolicy", outputs=results, raw_response=results, outputs_key_field="resourceId", ) def compute_firewall_insert(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Creates a new Google Cloud Compute Engine firewall rule. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The ID of the GCP project where the rule will be created. - resource_name (str): The name of the firewall rule. - description (str, optional): Description of the rule. - network (str, optional): The URL of the network for the rule. - priority (int, optional): Priority value for the rule (lower means higher priority). - source_ranges (str, optional): Comma-separated list of CIDR blocks for allowed sources. - destination_ranges (str, optional): Comma-separated list of CIDR blocks for destinations. - source_tags (str, optional): Comma-separated list of source tags. - target_tags (str, optional): Comma-separated list of target tags. - source_service_accounts (str, optional): Comma-separated list of source service accounts. - target_service_accounts (str, optional): Comma-separated list of target service accounts. - allowed (str, optional): Allowed protocols and ports (in JSON format). - denied (str, optional): Denied protocols and ports (in JSON format). - direction (str, optional): Direction of traffic ('INGRESS' or 'EGRESS'). - log_config_enable (bool, optional): Whether to enable logging for this rule. - disabled (bool, optional): Whether the rule should be disabled upon creation. Returns: CommandResults: Object containing the operation details of the firewall insert request, with `GCP.Compute.Operations` context output. """ project_id = args.get("project_id") resource_name = args.get("resource_name") body: dict[str, Any] = {"name": resource_name} if description := args.get("description"): body["description"] = description if network := args.get("network"): body["network"] = network if priority := args.get("priority"): body["priority"] = arg_to_number(priority) if sourceRanges := args.get("source_ranges"): body["sourceRanges"] = argToList(sourceRanges) if destinationRanges := args.get("destination_ranges"): body["destinationRanges"] = argToList(destinationRanges) if sourceTags := args.get("source_tags"): body["sourceTags"] = argToList(sourceTags) if targetTags := args.get("target_tags"): body["targetTags"] = argToList(targetTags) if sourceServiceAccounts := args.get("source_service_accounts"): body["sourceServiceAccounts"] = argToList(sourceServiceAccounts) if targetServiceAccounts := args.get("target_service_accounts"): body["targetServiceAccounts"] = argToList(targetServiceAccounts) if allowed := args.get("allowed"): body["allowed"] = parse_firewall_rule(allowed) if denied := args.get("denied"): body["denied"] = parse_firewall_rule(denied) if direction := args.get("direction"): body["direction"] = direction if logConfigEnable := args.get("log_config_enable"): body["logConfig"] = {"enable": argToBoolean(logConfigEnable)} if disabled := args.get("disabled"): body["disabled"] = argToBoolean(disabled) compute = GCPServices.COMPUTE.build(creds) demisto.debug(f"Firewall insert body for {resource_name} in project {project_id}: {body}") response = ( compute.firewalls() # pylint: disable=E1101 .insert(project=project_id, body=body) .execute() ) hr = tableToMarkdown( "Google Cloud Compute Firewall Rule Insert Operation Started Successfully", t=response, headers=OPERATION_TABLE, headerTransform=pascalToSpace, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response, raw_response=response) def compute_firewall_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Lists all firewall rules in the specified GCP project. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - limit (int, optional): Maximum number of results to return (1–500). Defaults to API default. - page_token (str, optional): Token to retrieve the next page of results. - filter (str, optional): Expression for filtering the listed resources. Returns: CommandResults: Object containing the list of firewall rules in the project, with `GCP.Compute.Firewall` and `GCP.Compute.FirewallNextToken` context outputs. """ project_id = args.get("project_id") limit = arg_to_number(args.get("limit")) page_token = args.get("page_token") flt = args.get("filter") validate_limit(limit) params: dict[str, Any] = { "project": project_id, "maxResults": limit, "pageToken": page_token, "filter": flt, } remove_nulls_from_dictionary(params) compute = GCPServices.COMPUTE.build(creds) response = compute.firewalls().list(**params).execute() # pylint: disable=E1101 items = response.get("items", []) next_token = response.get("nextPageToken") headers = ["name", "id", "direction", "priority", "sourceRanges", "targetTags", "creationTimestamp", "network", "disabled"] metadata = ( "Run the following command to retrieve the next batch of firewalls:\n" f"!gcp-compute-firewall-list project_id={project_id} page_token={next_token}" if next_token else None ) readable_output = tableToMarkdown( "GCP Compute Firewalls", items, headers=headers, headerTransform=pascalToSpace, metadata=metadata, ) outputs = { "GCP.Compute.Firewall(val.name && val.name == obj.name)": items, "GCP.Compute(true)": {"FirewallNextToken": next_token}, } return CommandResults( readable_output=readable_output, outputs=outputs, raw_response=items, ) def compute_firewall_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves details of a specific Google Cloud firewall rule. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - resource_name (str): The name of the firewall rule to retrieve. Returns: CommandResults: Object containing the firewall rule details under `GCP.Compute.Firewall`. If the firewall rule is not found, returns a human-readable message. """ project_id = args.get("project_id") resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) try: response = compute.firewalls().get(project=project_id, firewall=resource_name).execute() # pylint: disable=E1101 except HttpError as e: reason = e._get_reason() if e.resp.status == 404 and ("The resource" and "was not found" in reason): return CommandResults(readable_output=f"Firewall '{resource_name}' not found in project '{project_id}'") raise demisto.debug(f"Firewall get response for {project_id}: \n{response}") hr = tableToMarkdown( f"GCP Compute Firewall: {resource_name}", response, headerTransform=pascalToSpace, removeNull=True, ) return CommandResults( readable_output=hr, outputs_prefix="GCP.Compute.Firewall", outputs=response, outputs_key_field="name", raw_response=response, ) def compute_snapshots_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Lists all Compute Engine snapshots in a specified GCP project. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - limit (int, optional): Maximum number of results to return (1–500). - page_token (str, optional): Token for pagination. - filter (str, optional): Expression for filtering listed snapshots. Returns: CommandResults: Object containing a list of snapshot details under `GCP.Compute.Snapshot` and pagination token under `GCP.Compute.SnapshotNextToken`. """ project_id = args.get("project_id") limit = arg_to_number(args.get("limit")) page_token = args.get("page_token") flt = args.get("filter") params: dict[str, Any] = {"project": project_id} validate_limit(limit) if limit: params["maxResults"] = limit if page_token: params["pageToken"] = page_token if flt: params["filter"] = flt compute = GCPServices.COMPUTE.build(creds) response = compute.snapshots().list(**params).execute() # pylint: disable=E1101 demisto.debug(f"GCP Compute Snapshots \nresponse: \n{response}") items = response.get("items", []) next_token = response.get("nextPageToken") metadata = ( "Run the following command to retrieve the next batch of snapshots:\n" f"!gcp-compute-snapshots-list project_id={project_id} page_token={next_token}" if next_token else None ) headers = ["name", "status", "creationTimestamp"] hr = tableToMarkdown( "GCP Compute Snapshots", items, headers=headers, removeNull=True, metadata=metadata, headerTransform=pascalToSpace, ) outputs = { "GCP.Compute.Snapshot(val.id && val.id == obj.id)": items, "GCP.Compute(true)": {"SnapshotNextToken": next_token}, } return CommandResults(readable_output=hr, outputs=outputs, raw_response=response) def compute_snapshot_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves a specific Compute Engine snapshot by name. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - resource_name (str): The name of the snapshot to retrieve. Returns: CommandResults: Object containing the snapshot details under `GCP.Compute.Snapshot`. If not found, returns a readable message instead of raising an exception. """ project_id = args.get("project_id") resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) try: response = compute.snapshots().get(project=project_id, snapshot=resource_name).execute() # pylint: disable=E1101 except HttpError as e: reason = e._get_reason() if e.resp.status == 404 and ("The resource" and "was not found" in reason): return CommandResults(readable_output=f"Snapshot '{resource_name}' not found in project '{project_id}'") raise demisto.debug(f"Snapshot get response for {project_id}: \n{response}") hr = tableToMarkdown( f"GCP Compute Snapshot: {resource_name}", response, headerTransform=pascalToSpace, removeNull=True, ) return CommandResults( readable_output=hr, outputs_prefix="GCP.Compute.Snapshot", outputs=response, outputs_key_field="id", raw_response=response, ) def _collect_instance_ips(instance: dict[str, Any]) -> tuple[list[str], list[str]]: """ Collects internal and external IP addresses from a Compute Engine instance. Args: instance (dict): The instance resource object. Returns: Tuple[List[str], List[str]]: A tuple containing two lists - the first for internal IPs and the second for external IPs. """ internal_ips: list[str] = [] external_ips: list[str] = [] for nic in instance.get("networkInterfaces", []) or []: if ip := nic.get("networkIP"): internal_ips.append(ip) for ac in nic.get("accessConfigs", []) or []: if eip := ac.get("natIP"): external_ips.append(eip) return internal_ips, external_ips def _match_instance_by_ip(instance: dict[str, Any], ip_address: str, match_external: bool) -> tuple[bool, str]: """ Checks if the given IP address matches the instance IPs based on the match mode. Args: instance (dict): The instance resource object. ip_address (str): The IP address to match. match_external (bool): Whether to check external IPs (True) or internal IPs (False). Returns: Tuple[bool, str]: A tuple indicating whether a match was found, and the match type ('internal', 'external', or 'none'). """ internal_ips, external_ips = _collect_instance_ips(instance) if match_external: return (ip_address in external_ips, "external" if ip_address in external_ips else "none") return (ip_address in internal_ips, "internal" if ip_address in internal_ips else "none") def compute_instances_aggregated_list_by_ip(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Lists Compute Engine instances aggregated across all zones and filters them by IP address. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - ip_address (str): The IP address to match. - match_external (bool, optional): Whether to search external IPs (default is False). - limit (int, optional): Maximum number of results per API call. - page_token (str, optional): Token for pagination. Returns: CommandResults: Object containing matched instances under `GCP.Compute.Instance`, including match type and matched IP, along with readable summary table. """ project_id = args.get("project_id") ip_address = args.get("ip_address", "") match_external = argToBoolean(args.get("match_external", "false")) limit = arg_to_number(args.get("limit")) page_token = args.get("page_token") validate_limit(limit) params: dict[str, Any] = {"project": project_id} if limit: params["maxResults"] = limit if page_token: params["pageToken"] = page_token compute = GCPServices.COMPUTE.build(creds) response = compute.instances().aggregatedList(**params).execute() # pylint: disable=E1101 demisto.debug(f"Instances aggregated list response for {project_id}: \n{response}") matched: list[dict[str, Any]] = [] hr_items: list[dict[str, str]] = [] for scope in response.get("items", {}).values(): for inst in scope.get("instances", []) or []: is_match, match_type = _match_instance_by_ip(inst, ip_address, match_external) if is_match: internal_ips, external_ips = _collect_instance_ips(inst) matched.append(inst) hr_items.append( { "name": inst.get("name"), "id": inst.get("id"), "status": inst.get("status"), "zone": inst.get("zone"), "networkIP": ", ".join(internal_ips), "accessConfigs.natIP": ", ".join(external_ips), "matchType": match_type, "matchedIP": ip_address, } ) hr_headers = ["name", "id", "status", "zone", "networkIP", "accessConfigs.natIP", "matchType", "matchedIP"] hr = tableToMarkdown( "GCP Compute Instances (filtered by IP)", hr_items, headers=hr_headers, headerTransform=pascalToSpace, removeNull=True, ) return CommandResults( readable_output=hr, outputs_prefix="GCP.Compute.Instance", outputs=matched, outputs_key_field="id", raw_response=response, ) def compute_network_tag_set(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Adds or updates network tags for a Compute Engine VM instance. Args: creds (Credentials): Authorized GCP credentials used to access the Compute Engine API. args (dict): Command arguments including: - project_id (str): The GCP project ID. - zone (str): The zone of the instance (e.g., "us-central1-a"). - resource_name (str): The name of the VM instance. - tag (str): The tag or list of tags to apply. - add_tag (bool, optional): Whether to merge with existing tags (default: True). - tags_fingerprint (str): The current fingerprint of the instance's tags, required for updates. Returns: CommandResults: Object containing operation details under `GCP.Compute.Operations`, and a readable message confirming tag update. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) resource_name = args.get("resource_name") tags = argToList(args.get("tag")) add_tag = argToBoolean(args.get("add_tag", "true")) compute = GCPServices.COMPUTE.build(creds) fingerprint = args.get("tags_fingerprint", "") if add_tag: instance = compute.instances().get(project=project_id, zone=zone, instance=resource_name).execute() # pylint: disable=E1101 demisto.debug(f"Instance get response for {project_id}: \n{instance}") tags_obj = instance.get("tags", {}) items = tags_obj.get("items", []) or [] if tags not in items: tags.extend(items) body = {"items": tags, "fingerprint": fingerprint} response = ( compute.instances() # pylint: disable=E1101 .setTags(project=project_id, zone=zone, instance=resource_name, body=body) .execute() ) demisto.debug(f"Add network tag response for {project_id}: \n{response}") new_tag = args.get("tag") readable_output = f"Added '{new_tag}' tag to instance {resource_name} successfully\n" f"The full network tag list is: {tags}" return CommandResults( readable_output=readable_output, outputs=response, outputs_prefix="GCP.Compute.Operations", outputs_key_field="id", raw_response=response, ) def storage_bucket_policy_delete(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Deletes public IAM policy bindings from a GCS bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'resource_name' (bucket name) and optional 'entity'. Returns: CommandResults: Result of the policy removal operation. """ bucket = args.get("resource_name") entities_to_remove = set(argToList(args.get("entity", "allUsers"))) storage = GCPServices.STORAGE.build(creds) policy = storage.buckets().getIamPolicy(bucket=bucket).execute() # pylint: disable=E1101 modified = False updated_bindings = [] bindings = policy.get("bindings", []) for binding in bindings: role = binding["role"] original_members = set(binding.get("members", [])) filtered_members = original_members - entities_to_remove removed = original_members & entities_to_remove if removed: modified = True demisto.debug(f"Removing members {removed} from role '{role}'.") if filtered_members: updated_bindings.append({"role": role, "members": list(filtered_members)}) if modified: policy["bindings"] = updated_bindings storage.buckets().setIamPolicy(bucket=bucket, body=policy).execute() # pylint: disable=E1101 hr = ( f"Access permissions for {', '.join(f'`{e}`' for e in entities_to_remove)} were successfully " f"revoked from bucket **{bucket}**" ) else: hr = f"No IAM changes made for bucket '{bucket}'." return CommandResults(readable_output=hr) def compute_subnet_update(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Updates subnet properties such as flow logs and private Google access. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'region', 'resource_name', and optional flow log and private access flags. Returns: CommandResults: Result of the subnet patch operation. """ project_id = args.get("project_id") region = args.get("region") resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) hr, response_patch, response_set = "", {}, {} patch_body = {} if enable_flow_logs := args.get("enable_flow_logs"): patch_body["enableFlowLogs"] = argToBoolean(enable_flow_logs) subnetwork = ( compute.subnetworks() # pylint: disable=E1101 .get(project=project_id, region=region, subnetwork=resource_name) .execute() ) fingerprint = subnetwork.get("fingerprint") if not fingerprint: raise DemistoException("Fingerprint for the subnetwork is missing.") patch_body["fingerprint"] = fingerprint response_patch = ( compute.subnetworks() # pylint: disable=E1101 .patch(project=project_id, region=region, subnetwork=resource_name, body=patch_body) .execute() ) hr += tableToMarkdown( f"Flow Logs configuration for subnet {resource_name} in project {project_id}", t=response_patch, headers=OPERATION_TABLE, removeNull=True, ) if enable_private_access := args.get("enable_private_ip_google_access"): response_set = ( compute.subnetworks() # pylint: disable=E1101 .setPrivateIpGoogleAccess( project=project_id, region=region, subnetwork=resource_name, body={"privateIpGoogleAccess": argToBoolean(enable_private_access)}, ) .execute() ) hr += tableToMarkdown( f"Private IP Google Access configuration for subnet {resource_name} in project {project_id}", t=response_set, headers=OPERATION_TABLE, removeNull=True, ) if not hr: hr = f"No updates were made to subnet configuration for {resource_name} in project {project_id}" return CommandResults(readable_output=hr) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=[response_patch, response_set]) # def compute_instance_metadata_add(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Adds metadata key-value pairs to a GCE instance. # # Args: # creds (Credentials): GCP credentials. # args (dict[str, Any]): Must include 'project_id', 'zone', 'resource_name', and 'metadata' in key=value format. # # Returns: # CommandResults: Result of the metadata update operation. # """ # project_id = args.get("project_id") # zone = extract_zone_name(args.get("zone")) # resource_name = args.get("resource_name") # metadata_str: str = args.get("metadata", "") # compute = GCPServices.COMPUTE.build(creds) # # instance = compute.instances().get(project=project_id, zone=zone, instance=resource_name).execute() # pylint: disable=E1101 # fingerprint = instance.get("metadata", {}).get("fingerprint") # existing_items = instance.get("metadata", {}).get("items", []) # existing_metadata = {item["key"]: item["value"] for item in existing_items} # # new_items = parse_metadata_items(metadata_str) # for item in new_items: # existing_metadata[item["key"]] = item["value"] # # body = {"fingerprint": fingerprint, "items": [{"key": k, "value": v} for k, v in existing_metadata.items()]} # response = ( # compute.instances() # pylint: disable=E1101 # .setMetadata( # project=project_id, # zone=zone, # instance=resource_name, # body=body, # ) # .execute() # ) # # hr = tableToMarkdown( # "Google Cloud Compute Project Metadata Update Operation Started Successfully", # t=response, # headers=OPERATION_TABLE, # removeNull=True, # ) # return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) def container_cluster_security_update(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Updates security-related configurations for a GKE cluster. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'region', 'resource_name' and optional security flags. - enable_intra_node_visibility: Whether to enable intra-node visibility. - enable_master_authorized_networks: Whether to enable master authorized networks (required if cidrs provided). - cidrs: Comma-separated list of CIDR blocks (e.g. "192.168.0.0/24,10.0.0.0/32"). Required if enable_master_authorized_networks is True. Returns: CommandResults: Result of the cluster update operation. """ project_id = args.get("project_id") region = args.get("region") resource_name = args.get("resource_name") cidrs = argToList(args.get("cidrs")) if "enable_master_authorized_networks" in args and "enable_intra_node_visibility" in args: raise DemistoException( "Only one update can be applied to a cluster with each request. " "Please provide either 'enable_intra_node_visibility' " "or 'enable_master_authorized_networks', not both." ) if cidrs and not args.get("enable_master_authorized_networks"): raise DemistoException( "You provided CIDRs, but 'enable_master_authorized_networks' is not enabled. " "To apply CIDRs, you must enable Master Authorized Networks." ) container = GCPServices.CONTAINER.build(creds) update_fields: dict[str, Any] = {} if enable_intra := args.get("enable_intra_node_visibility"): update_fields["desiredIntraNodeVisibilityConfig"] = {"enabled": argToBoolean(enable_intra)} if enable_master := args.get("enable_master_authorized_networks"): update_fields["desiredControlPlaneEndpointsConfig"] = { "ipEndpointsConfig": { "authorizedNetworksConfig": { "enabled": argToBoolean(enable_master), "cidrBlocks": [{"cidrBlock": cidr} for cidr in cidrs], } } } response = ( container.projects() # pylint: disable=E1101 .locations() .clusters() .update(name=f"projects/{project_id}/locations/{region}/clusters/{resource_name}", body={"update": update_fields}) .execute() ) hr = tableToMarkdown( "Google Cloud Container Cluster Security Update Operation Started Successfully", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Container.Operations", outputs=response) def storage_bucket_metadata_update(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Updates metadata configuration for a GCS bucket. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'resource_name' (bucket name) and optional versioning/uniform access flags. Returns: CommandResults: Result of the metadata update operation. """ bucket = args.get("resource_name") storage = GCPServices.STORAGE.build(creds) body: dict[str, Any] = {} if enable_versioning := args.get("enable_versioning"): body["versioning"] = {"enabled": argToBoolean(enable_versioning)} if enable_uniform_access := args.get("enable_uniform_access"): body.setdefault("iamConfiguration", {})["uniformBucketLevelAccess"] = {"enabled": argToBoolean(enable_uniform_access)} response = storage.buckets().patch(bucket=bucket, body=body).execute() # pylint: disable=E1101 data_res = { "name": response.get("name"), "id": response.get("id"), "kind": response.get("kind"), "selfLink": response.get("selfLink"), "projectNumber": response.get("projectNumber"), "updated": response.get("updated"), "location": response.get("location"), "versioning": response.get("versioning", {}).get("enabled"), "uniformBucketLevelAccess": response.get("iamConfiguration", {}).get("uniformBucketLevelAccess", {}).get("enabled"), } hr = tableToMarkdown(f"Metadata for bucket {bucket} was successfully updated.", data_res, removeNull=True) return CommandResults( readable_output=hr, outputs_prefix="GCP.StorageBucket.Metadata", outputs=response, outputs_key_field="name" ) def iam_project_policy_binding_remove(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Removes specified IAM role bindings from a GCP project. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'member', and 'role'. 'member' can be a single member or a comma-separated list. Returns: CommandResults: Result of the IAM binding removal operation. """ project_id = args.get("project_id") entities_to_remove = set(argToList(args.get("member"))) role = args.get("role") resource_manager = GCPServices.RESOURCE_MANAGER.build(creds) policy_request = resource_manager.projects().getIamPolicy(resource=f"projects/{project_id}") # pylint: disable=E1101 policy = policy_request.execute() modified = False updated_bindings = [] bindings = policy.get("bindings", []) for binding in bindings: binding_role = binding["role"] if binding_role == role: original_members = set(binding.get("members", [])) filtered_members = original_members - entities_to_remove removed = original_members & entities_to_remove if removed: modified = True demisto.debug(f"Removing members {removed} from role '{binding_role}'.") if filtered_members: updated_bindings.append({"role": binding_role, "members": list(filtered_members)}) else: updated_bindings.append(binding) if modified: policy["bindings"] = updated_bindings set_policy_request = resource_manager.projects().setIamPolicy( # pylint: disable=E1101 resource=f"projects/{project_id}", body={"policy": policy} ) set_policy_request.execute() hr = ( f"IAM role '{role}' was successfully removed from {', '.join(f'`{e}`' for e in entities_to_remove)} " f"in project **{project_id}**" ) else: hr = f"No IAM changes made for role '{role}' in project '{project_id}'." return CommandResults(readable_output=hr) # The command is currently unsupported. # def iam_project_deny_policy_create(creds, args: dict[str, Any]) -> CommandResults: # """ # Creates an IAM deny policy to explicitly block access to specific resources. # # Args: # creds: GCP credentials. # args (dict[str, Any]): # - project_id (str): GCP project ID. # - policy_id (str): Deny policy identifier. # - display_name (str): Display name for the policy. # - denied_principals (str): Comma-separated principals to deny. # - denied_permissions (str): Comma-separated permissions to deny. # # Returns: # CommandResults: Result of the deny policy creation. # """ # # project_id = args.get("project_id") # policy_id = args.get("policy_id") # display_name = args.get("display_name") # denied_principals = argToList(args.get("denied_principals")) # denied_permissions = argToList(args.get("denied_permissions")) # # iam = GCPServices.IAM_V2.build(creds) # attachment_point = f"cloudresourcemanager.googleapis.com%2Fprojects%2F{project_id}" # parent = f"policies/{attachment_point}/denypolicies" # # policy = { # "displayName": display_name, # "rules": [ # { # "denyRule": { # "deniedPrincipals": denied_principals, # "deniedPermissions": denied_permissions, # } # } # ], # } # # response = iam.policies().createPolicy(parent=parent, policyId=policy_id, body=policy).execute() # pylint: disable=E1101 # # readable_output = f"Deny policy `{policy_id}` was successfully created and attached to `{project_id}`." # return CommandResults( # readable_output=readable_output, # outputs_prefix="GCP.IAM.DenyPolicy", # outputs=response, # ) def compute_instance_service_account_set(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Sets the service account for a GCP Compute Engine VM instance. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'zone', 'resource_name', and optional 'service_account' and 'scopes'. Returns: CommandResults: Result of the service account update operation. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) resource_name = args.get("resource_name") service_account_email = args.get("service_account_email", "") scopes = argToList(args.get("scopes", [])) compute = GCPServices.COMPUTE.build(creds) body = {"email": service_account_email, "scopes": scopes} response = ( compute.instances() # pylint: disable=E1101 .setServiceAccount(project=project_id, zone=zone, instance=resource_name, body=body) .execute() ) hr = tableToMarkdown( f"Service Account Updated Operation Started Successfully for VM Instance {resource_name} in project {project_id}.", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) def compute_instance_service_account_remove(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Removes a service account from a GCP Compute Engine VM instance. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'zone', and 'resource_name'. Returns: CommandResults: Result of the service account removal operation. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) body = {"email": "", "scopes": []} response = ( compute.instances() # pylint: disable=E1101 .setServiceAccount(project=project_id, zone=zone, instance=resource_name, body=body) .execute() ) hr = tableToMarkdown( f"Service Account Removed Operation Started Successfully for VM Instance {resource_name} in project {project_id}.", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) # The command is currently unsupported. # def iam_group_membership_delete(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Removes a user or service account from a Google Cloud Identity group. # # Args: # creds (Credentials): GCP credentials. # args (dict[str, Any]): Must include 'group_id' and 'membership_id'. # # Returns: # CommandResults: Result of the group membership removal. # """ # group_id = args.get("group_id") # membership_id = args.get("membership_id") # # cloud_identity = GCPServices.CLOUD_IDENTITY.build(creds) # membership_name = f"groups/{group_id}/memberships/{membership_id}" # cloud_identity.groups().memberships().delete(name=membership_name).execute() # pylint: disable=E1101 # # hr = f"Membership {membership_id} was deleted from group {group_id} successfully." # # return CommandResults(readable_output=hr) # The command is currently unsupported. # def iam_service_account_delete(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Deletes a GCP IAM service account. # # Args: # creds (Credentials): GCP credentials. # args (dict[str, Any]): Must include 'project_id' and 'service_account_email'. # # Returns: # CommandResults: Result of the service account deletion. # """ # project_id = args.get("project_id") # service_account_email = args.get("service_account_email") # # iam = GCPServices.IAM_V1.build(creds) # # name = f"projects/{project_id}/serviceAccounts/{service_account_email}" # # iam.projects().serviceAccounts().delete(name=name).execute() # pylint: disable=E1101 # hr = f"Service account {service_account_email} was successfully deleted from project {project_id}." # return CommandResults(readable_output=hr) def compute_instance_start(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Starts a stopped Compute Engine VM instance. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'zone', and 'resource_name'. Returns: CommandResults: Result of the VM start operation. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) response = ( compute.instances() # pylint: disable=E1101 .start(project=project_id, zone=zone, instance=resource_name) .execute() ) hr = tableToMarkdown( f"VM instance {resource_name} was started in project {project_id}", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) def compute_instance_stop(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Stops a running Compute Engine VM instance. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id', 'zone', and 'resource_name'. Returns: CommandResults: Result of the VM stop operation. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) resource_name = args.get("resource_name") compute = GCPServices.COMPUTE.build(creds) response = ( compute.instances() # pylint: disable=E1101 .stop(project=project_id, zone=zone, instance=resource_name) .execute() ) hr = tableToMarkdown( f"VM instance {resource_name} was stopped in project {project_id}", t=response, headers=OPERATION_TABLE, removeNull=True, ) return CommandResults(readable_output=hr, outputs_prefix="GCP.Compute.Operations", outputs=response) # The command is currently unsupported. # def admin_user_update(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Updates user account fields in GSuite, such as names, org unit, or status. # # Args: # creds (Credentials): GCP credentials with admin directory scopes. # args (dict[str, Any]): Must include 'user_key' and 'update_fields'. # # Returns: # CommandResults: Result of the user update operation. # """ # user_key = args.get("user_key") # update_fields = json.loads(args.get("update_fields", "{}")) # # directory = GCPServices.ADMIN_DIRECTORY.build(creds) # # try: # response = directory.users().update(userKey=user_key, body=update_fields).execute() # pylint: disable=E1101 # hr = f"GSuite user {user_key} was successfully updated." # except Exception as e: # raise DemistoException(f"Failed to update user: {str(e)}") from e # # return CommandResults(readable_output=hr, outputs_prefix="GCP.GSuite.User", outputs=response) # The command is currently unsupported. # def admin_user_password_reset(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Resets the password for a GSuite user account. # # Args: # creds (Credentials): GCP credentials with admin directory security scope. # args (dict[str, Any]): Must include 'user_key' and 'new_password'. # # Returns: # CommandResults: Result of the password reset operation. # """ # user_key = args.get("user_key") # new_password = args.get("new_password") # # directory = GCPServices.ADMIN_DIRECTORY.build(creds) # # try: # # Create password update body # password_update = {"password": new_password} # # response = directory.users().update(userKey=user_key, body=password_update).execute() # pylint: disable=E1101 # hr = f"Password for GSuite user {user_key} was successfully reset." # except Exception as e: # raise DemistoException(f"Failed to reset password: {str(e)}") from e # # return CommandResults(readable_output=hr, outputs_prefix="GCP.GSuite.User.Password", outputs=response) # The command is currently unsupported. # def admin_user_signout(creds: Credentials, args: dict[str, Any]) -> CommandResults: # """ # Invalidates all active sessions for a GSuite user, forcing them to sign in again. # # Args: # creds (Credentials): GCP credentials with admin directory security scope. # args (dict[str, Any]): Must include 'user_key'. # # Returns: # CommandResults: Result of the signout operation. # """ # user_key = args.get("user_key") # # directory = GCPServices.ADMIN_DIRECTORY.build(creds) # # try: # directory.users().signOut(userKey=user_key).execute() # pylint: disable=E1101 # hr = f"All active sessions for GSuite user {user_key} were successfully signed out." # except Exception as e: # raise DemistoException(f"Failed to sign out user: {str(e)}") from e # # return CommandResults(readable_output=hr) def gcp_compute_instances_list_command(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves the list of instances contained within the specified zone. Args: creds (Credentials): GCP credentials with admin directory security scope. args (dict[str, Any]): Must include 'resource_name'. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) limit = (arg_to_number(args.get("limit")) or 50) if args.get("limit", "50") != "0" else 0 filters = args.get("filters") order_by = args.get("order_by") page_token = args.get("page_token") validate_limit(limit) compute = GCPServices.COMPUTE.build(creds) response = ( compute.instances() .list(project=project_id, zone=zone, filter=filters, maxResults=limit, orderBy=order_by, pageToken=page_token) .execute() ) next_page_token = response.get("nextPageToken", "") metadata = ( "Run the following command to retrieve the next batch of instances:\n" f"!gcp-compute-instances-list project_id={project_id} zone={zone} page_token={next_page_token}" if next_page_token else None ) if limit != 50: metadata = f"{metadata} {limit=}" if next_page_token: response["InstancesNextPageToken"] = response.pop("nextPageToken") if response.get("items"): response["Instances"] = response.pop("items") hr_data = [] for instance in response.get("Instances", [{}]): d = { "id": instance.get("id"), "name": instance.get("name"), "kind": instance.get("kind"), "creationTimestamp": instance.get("creationTimestamp"), "description": instance.get("description"), "status": instance.get("status"), "machineType": instance.get("machineType"), "zone": instance.get("zone"), } hr_data.append(d) readable_output = tableToMarkdown( "GCP Instances", hr_data, headers=["id", "name", "kind", "creationTimestamp", "description", "status", "machineType", "zone"], headerTransform=pascalToSpace, removeNull=True, metadata=metadata, ) outputs = { "GCP.Compute.Instances(val.id && val.id == obj.id)": response.get("Instances", []), "GCP.Compute(true)": { "InstancesNextPageToken": response.get("InstancesNextPageToken"), "InstancesSelfLink": response.get("selfLink"), "InstancesWarning": response.get("warning"), }, } remove_empty_elements(outputs) return CommandResults( readable_output=readable_output, outputs=outputs, raw_response=response, ) def gcp_compute_instance_get_command(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Returns the specified Instance resource. Args: creds (Credentials): GCP credentials with admin directory security scope. args (dict[str, Any]): Must include 'resource_name'. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) instance = args.get("instance") compute = GCPServices.COMPUTE.build(creds) response = compute.instances().get(project=project_id, zone=zone, instance=instance).execute() hr_data = { "id": response.get("id"), "name": response.get("name"), "kind": response.get("kind"), "creationTimestamp": response.get("creationTimestamp"), "description": response.get("description"), "status": response.get("status"), "machineType": response.get("machineType"), "labels": response.get("labels"), "labelFingerprint": response.get("labelFingerprint"), } readable_output = tableToMarkdown( f"GCP Instance {instance} from zone {zone}", hr_data, headers=["id", "name", "kind", "creationTimestamp", "description", "status", "machineType", "labels", "labelFingerprint"], headerTransform=pascalToSpace, removeNull=True, ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Instances", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_instance_label_set_command(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Sets labels on an instance. Args: creds (Credentials): GCP credentials with admin directory security scope. args (dict[str, Any]): Must include 'resource_name'. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project_id = args.get("project_id") zone = extract_zone_name(args.get("zone")) instance = args.get("instance") label_fingerprint = args.get("label_fingerprint", "") add_labels = argToBoolean(args.get("add_labels", False)) labels = parse_labels(args.get("labels", "")) demisto.debug(f"The parsed {labels=}") current_labels = {} if add_labels: instance_info = gcp_compute_instance_get_command(creds, args).outputs if isinstance(instance_info, dict): current_labels = instance_info.get("labels", {}) demisto.debug(f"Adding the new labels {labels=} to the current ones {current_labels}") body = {"labels": current_labels | labels, "labelFingerprint": label_fingerprint} compute = GCPServices.COMPUTE.build(creds) response = compute.instances().setLabels(project=project_id, zone=zone, instance=instance, body=body).execute() data_res = { "status": response.get("status"), "kind": response.get("kind"), "name": response.get("name"), "id": response.get("id"), "progress": response.get("progress"), "operationType": response.get("operationType"), } headers = ["id", "name", "kind", "status", "progress", "operationType"] readable_output = tableToMarkdown(f"GCP instance {instance} labels update", data_res, headers=headers, removeNull=True) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Operations", outputs_key_field="id", outputs=response, raw_response=response, ) def bq_dataset_policy_remove_command(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Removes an email from the dataset access list. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Must include 'project_id' and 'dataset_id'. Returns: CommandResults: Result of the dataset patch operation. """ project_id = args.get("project_id") dataset_id = args.get("dataset_id") email = args.get("email", "") body: dict[str, Any] = {} bigquery = GCPServices.BIGQUERY.build(creds) # First, get the current dataset to retrieve the access list current_dataset = bigquery.datasets().get(projectId=project_id, datasetId=dataset_id).execute() demisto.debug(f"[GCP] {current_dataset=}") current_dataset_access = current_dataset.get("access", []) # Filter out access entries matching the email # Access entries can have both 'userByEmail', and 'groupByEmail' new_access = [ entry for entry in current_dataset_access if entry.get("userByEmail") != email and entry.get("groupByEmail") != email ] if len(new_access) == len(current_dataset_access): demisto.debug(f"[GCP] Email {email} not found in access list for dataset {dataset_id}") return CommandResults( readable_output=f"The provided email {email} wasn't found in access list of the dataset {dataset_id}." ) else: body["access"] = new_access demisto.debug(f"[GCP] Removed an email from access list for dataset {dataset_id}, {new_access=}") demisto.debug(f"BigQuery dataset policy update body for {dataset_id} in project {project_id}: {body}") response = bigquery.datasets().patch(projectId=project_id, datasetId=dataset_id, body=body).execute() hr = tableToMarkdown( f"BigQuery Dataset {dataset_id} Updated Successfully", response, headerTransform=pascalToSpace, removeNull=True, headers=["id", "datasetReference", "friendlyName", "description", "location", "lastModifiedTime"], ) return CommandResults( readable_output=hr, outputs_prefix="GCP.BigQuery.Datasets", outputs=response, outputs_key_field="id", raw_response=response, ) def validate_limit(limit): """ Validates that the provided limit argument is within the allowed range. Args: limit (int): The limit value to validate. Raises: DemistoException: If the limit is not set or is outside the allowed range (1-500 inclusive). """ if limit > 500 or limit < 1: raise DemistoException( f"The acceptable values of the argument limit are 1 to 500, inclusive. Currently the value is {limit}" ) def health_check(shared_creds: dict, project_id: str, connector_id: str) -> HealthCheckError | list[HealthCheckError] | None: """Tests connectivity to GCP. This function is specifically used for COOC health checks to verify connectivity. Args: shared_creds (dict): Pre-fetched cloud credentials (format varies by provider). project_id (str): The GCP project ID to check against. connector_id (str): The connector ID for the Cloud integration. Returns: A list of HealthCheckError or None: A list of HealthCheckError if there's at least one issue, None if successful. """ try: token = shared_creds.get("access_token") if not token: raise DemistoException("Failed to authenticate with GCP - token is missing from credentials") creds = Credentials(token=token) except Exception as e: return HealthCheckError( account_id=project_id, connector_id=connector_id, message=str(e), error_type=ErrorType.CONNECTIVITY_ERROR, ) # Perform sample check on GCP services service_results = GCPServices.test_all_services(creds, project_id) errors_list = [] for _, success, error_message in service_results: if not success and "Permission" not in error_message: errors_list.append( HealthCheckError( account_id=project_id, connector_id=connector_id, message=f"Sample check failed for account {project_id}. Error: {error_message}", error_type=ErrorType.CONNECTIVITY_ERROR, ) ) if errors_list: return errors_list return None def _resolve_project_id_for_test(params: dict[str, Any]) -> str: """Resolves the project ID for the connectivity test. Uses the 'GCP Project ID' parameter when set; otherwise falls back to the 'project_id' field of the Service Account private key JSON (mirroring the resolution done in ``get_credentials``). Args: params (dict[str, Any]): Integration configuration parameters. Returns: str: The resolved project ID. Raises: DemistoException: If a project ID cannot be resolved from either source. """ project_id = (params.get("project_id") or "").strip() if project_id: return project_id password = ((params.get("credentials") or {}).get("password") or "").strip() if password: try: service_account_info = json.loads(password) except json.JSONDecodeError: service_account_info = {} project_id = (service_account_info.get("project_id") or "").strip() if not project_id: raise DemistoException( "Missing required parameter 'project_id'. Set the 'GCP Project ID' field in the integration " "configuration, or include 'project_id' in the Service Account private key JSON." ) return project_id def test_module(creds: Credentials, params: dict[str, Any]) -> str: """Tests connectivity to GCP by issuing a lightweight, project-scoped probe per service. The Resource Manager API is tried first (using its permission-free ``testIamPermissions`` endpoint). If its API is not enabled on the project (403 SERVICE_DISABLED), the probe falls back to the other GCP services in turn, so a single disabled API does not fail the whole connectivity test. The test passes as soon as any service responds successfully. Args: creds (Credentials): GCP credentials to test. params (dict[str, Any]): Integration parameters. The project ID is read from 'project_id' or, if empty, from the Service Account private key JSON. Returns: str: "ok" if the test is successful. Raises: DemistoException: If credentials are invalid, the API call fails, or every probed service has its API disabled. """ project_id = _resolve_project_id_for_test(params) services_to_try = [ GCPServices.RESOURCE_MANAGER, GCPServices.COMPUTE, GCPServices.STORAGE, GCPServices.CONTAINER, GCPServices.BIGQUERY, ] for service in services_to_try: try: service.test_connectivity(creds, project_id) demisto.debug(f"[GCP test_module] Successfully authenticated against project {project_id} via {service.api_name}") return "ok" except Exception as e: # A disabled-API 403 is not a real failure - skip this service and try the next one. if isinstance(e, HttpError) and _is_service_disabled_error(e): demisto.debug( f"[GCP test_module] {service.api_name} API is disabled on project {project_id}; trying next service." ) continue demisto.debug(f"[GCP test_module] Test failed on {service.api_name}: {str(e)}") raise DemistoException(f"Failed to connect to GCP project '{project_id}': {str(e)}") # Every probed service had its API disabled - none could be reached. raise DemistoException( f"Failed to connect to GCP project '{project_id}': all probed GCP service APIs are disabled. " "Enable at least one of the required GCP APIs on the project and try again." ) def get_credentials(args: dict, params: dict) -> Credentials: """Returns GCP credentials based on the deployment type. - Marketplace (Cortex XSOAR/Cortex XSIAM): builds credentials from the service account JSON key in ``credentials.password``. If ``project_id`` is not already in ``args``, it is resolved using the priority: ``args`` > ``params`` > the ``project_id`` field of the service account JSON. - Cortex Platform: fetches a short-lived token from CTS via ``get_cloud_credentials``. Args: args (dict): Command arguments (may contain ``project_id``). params (dict): Integration configuration parameters. Returns: Credentials: Authenticated GCP credentials object. Raises: DemistoException: If credentials cannot be retrieved or are invalid. """ creds_param = params.get("credentials") or {} password = (creds_param.get("password") or "").strip() if password: # --- Cortex XSOAR/Cortex XSIAM path: service account JSON key --- try: service_account_info = json.loads(password) except json.JSONDecodeError: raise DemistoException( "Invalid Service Account JSON format in the 'credentials' parameter. " "Please paste the raw contents of the downloaded JSON key file." ) try: creds = google_service_account.Credentials.from_service_account_info( service_account_info, scopes=["https://www.googleapis.com/auth/cloud-platform"], ) except Exception as e: raise DemistoException(f"Failed to build GCP credentials from service account JSON: {str(e)}") # Propagate project_id to args using priority: args > params > service account JSON if not args.get("project_id"): if params.get("project_id"): args["project_id"] = params["project_id"] elif service_account_info.get("project_id"): args["project_id"] = service_account_info["project_id"] else: raise DemistoException( "Missing required parameter 'project_id'. Provide it as a command argument, set the " "'GCP Project ID' field in the integration configuration, or include 'project_id' in the " "Service Account JSON key." ) demisto.debug("[GCP get_credentials] Using service account credentials (marketplace path)") return creds # --- Cortex Platform path: CTS token-based authentication --- project_id = args.get("project_id") if not project_id: raise DemistoException("Missing required parameter 'project_id'") try: credential_data = get_cloud_credentials(CloudTypes.GCP.value, project_id) except Exception as e: raise DemistoException(f"Failed to authenticate with GCP via CTS: {str(e)}") token = credential_data.get("access_token") if not token: raise DemistoException("Failed to retrieve GCP access token - token is missing from CTS credentials") creds = Credentials(token=token) demisto.debug(f"[GCP get_credentials] {project_id}: Using CTS token-based credentials (Cortex Platform path)") return creds def gcp_compute_network_get_command(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Returns the specified network. Args: creds (Credentials): GCP credentials with admin directory security scope. args (dict[str, Any]): _description_ Returns: CommandResults: _description_ """ project = args.get("project_id") network = args.get("network") compute = GCPServices.COMPUTE.build(creds) response = compute.networks().get(project=project, network=network).execute() data_res = { "name": response.get("name"), "id": response.get("id"), "creationTimestamp": response.get("creationTimestamp"), "description": response.get("description"), } headers = ["id", "name", "creationTimestamp", "description"] readable_output = tableToMarkdown( f"GCP network {network}", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Networks", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_image_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Returns the specified image. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): _description_ Returns: CommandResults: _description_ """ project = args.get("project_id") image = args.get("image") compute = GCPServices.COMPUTE.build(creds) response = compute.images().get(project=project, image=image).execute() data_res = { "id": response.get("id"), "name": response.get("name"), "creationTimestamp": response.get("creationTimestamp"), "description": response.get("description"), } headers = ["id", "name", "creationTimestamp", "description"] readable_output = tableToMarkdown( f"GCP image {image}", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Images", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_region_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Get a specified region resource. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): _description_ Returns: CommandResults: _description_ """ project = args.get("project_id") region = args.get("region") compute = GCPServices.COMPUTE.build(creds) response = compute.regions().get(project=project, region=region).execute() data_res = {"id": response.get("id"), "name": response.get("name"), "status": response.get("status")} headers = ["id", "name", "status"] readable_output = tableToMarkdown( f"GCP region {region}", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Regions", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_instance_group_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Returns the specified instance group. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): _description_ Returns: CommandResults: _description_ """ project = args.get("project_id") instance_group = args.get("instance_group") zone = args.get("zone") compute = GCPServices.COMPUTE.build(creds) response = compute.instanceGroups().get(project=project, zone=zone, instanceGroup=instance_group).execute() data_res = { "id": response.get("id"), "name": response.get("name"), "zone": response.get("zone"), "network": response.get("network"), } headers = ["id", "name", "zone", "network"] readable_output = tableToMarkdown( f"GCP instanceGroups {instance_group}", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.InstanceGroups", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_zone_get(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Get a specified zone resource. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): _description_ Returns: CommandResults: _description_ """ project = args.get("project_id") zone = args.get("zone") compute = GCPServices.COMPUTE.build(creds) response = compute.zones().get(project=project, zone=zone).execute() data_res = { "status": response.get("status"), "name": response.get("name"), "id": response.get("id"), } headers = ["id", "name", "status"] readable_output = tableToMarkdown( f"GCP zone {zone}", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Zones", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_network_insert(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Creates a subnet-mode network in the specified project using the data provided. Args: creds (Credentials): GCP credentials. args (dict[str, Any]): Arguments including: - name: Name of the network - description: Optional description - auto_create_sub_networks: "true"/"false" (optional, defaults to True) - routing_config_routing_mode: "REGIONAL" or "GLOBAL" (optional) - project_id: GCP project ID Returns: CommandResults: The result of the network creation operation. """ config = {} # Name (required) if args.get("name"): config["name"] = args.get("name", "") else: raise ValueError("The 'name' argument is required to create a network.") # Description (optional) if args.get("description"): config["description"] = args.get("description") # Auto-create subnets (default to True) auto_create_sub_networks = argToBoolean(args.get("auto_create_sub_networks", True)) if auto_create_sub_networks is not None: config["autoCreateSubnetworks"] = auto_create_sub_networks else: config["autoCreateSubnetworks"] = True # default to subnet-mode network # Optional routing config if args.get("routing_config_routing_mode"): config["routingConfig"] = {"routingMode": args["routing_config_routing_mode"]} # Project ID project = args.get("project_id") # Build the compute service compute = GCPServices.COMPUTE.build(creds) # Execute the insert network request response = compute.networks().insert(project=project, body=config).execute() # Prepare output data_res = { "status": response.get("status"), "kind": response.get("kind"), "name": response.get("name"), "id": response.get("id"), "progress": response.get("progress"), "operationType": response.get("operationType"), } headers = ["status", "kind", "id", "progress", "operationType", "name"] readable_output = tableToMarkdown( "Google Cloud Compute Network Insert", data_res, headers=headers, removeNull=True, headerTransform=pascalToSpace ) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Operations", outputs_key_field="id", outputs=response, raw_response=response, ) def gcp_compute_networks_list(creds: Credentials, args: dict[str, Any]) -> CommandResults: """ Retrieves the list of networks available to the specified project. """ project = args.get("project_id") limit = (arg_to_number(args.get("limit")) or 50) if args.get("limit", "50") != "0" else 0 filters = args.get("filters") order_by = args.get("order_by") page_token = args.get("page_token") validate_limit(limit) data_res = [] compute = GCPServices.COMPUTE.build(creds) response = ( compute.networks() .list( project=project, filter=filters, maxResults=limit, orderBy=order_by, pageToken=page_token, ) .execute() ) next_page_token = response.get("nextPageToken") metadata = ( "Run the following command to retrieve the next batch of networks:\n" f"!gcp-compute-networks-list project_id={project} page_token={next_page_token}" if next_page_token else None ) if limit != 50: metadata = f"{metadata} {limit=}" if next_page_token: response["NetworksNextPageToken"] = response.pop("nextPageToken") if response.get("items"): response["Networks"] = response.pop("items") for item in response.get("Networks", [{}]): data_res_item = { "name": item.get("name"), "id": item.get("id"), "creationTimestamp": item.get("creationTimestamp"), "status": item.get("status"), } data_res.append(data_res_item) headers = ["name", "id", "creationTimestamp", "status"] readable_output = tableToMarkdown( "Google Cloud Compute Networks", data_res, headers=headers, removeNull=True, metadata=metadata, headerTransform=pascalToSpace, ) outputs = { "GCP.Compute.Networks(val.id && val.id == obj.id)": response.get("Networks", []), "GCP.Compute(true)": { "NetworksNextPageToken": response.get("NetworksNextPageToken"), "NetworksSelfLink": response.get("selfLink"), "outputsWarning": response.get("warning"), }, } remove_empty_elements(outputs) return CommandResults( readable_output=readable_output, outputs_prefix="GCP.Compute.Networks", outputs_key_field="id", outputs=outputs, raw_response=response, ) def main(): # pragma: no cover """ Main function to route commands and execute logic. Routing logic for ``test-module``: - **Cortex Platform**: ``get_connector_id()`` returns a connector ID → delegates to ``run_health_check_for_accounts`` (COOC health check). - **Cortex XSOAR / Cortex XSIAM (marketplace)**: no connector ID → calls ``test_module`` directly with the integration ``params`` so it can read ``project_id`` from the instance configuration. All other commands retrieve credentials via ``get_credentials`` and dispatch to the appropriate handler. """ command = demisto.command() args = demisto.args() params = demisto.params() try: command_map: dict[str, Callable[[Any, dict], Any]] = { "test-module": lambda creds, _args: test_module(creds, params), # Compute Engine commands "gcp-compute-firewall-patch": compute_firewall_patch, "gcp-compute-firewall-insert": compute_firewall_insert, "gcp-compute-firewall-list": compute_firewall_list, "gcp-compute-firewall-get": compute_firewall_get, "gcp-compute-snapshots-list": compute_snapshots_list, "gcp-compute-snapshot-get": compute_snapshot_get, "gcp-compute-instances-aggregated-list-by-ip": compute_instances_aggregated_list_by_ip, "gcp-compute-network-tag-set": compute_network_tag_set, "gcp-compute-subnet-update": compute_subnet_update, "gcp-compute-instance-service-account-set": compute_instance_service_account_set, "gcp-compute-instance-service-account-remove": compute_instance_service_account_remove, "gcp-compute-instance-start": compute_instance_start, "gcp-compute-instance-stop": compute_instance_stop, "gcp-compute-instances-list": gcp_compute_instances_list_command, "gcp-compute-instance-get": gcp_compute_instance_get_command, "gcp-compute-instance-labels-set": gcp_compute_instance_label_set_command, "gcp-compute-network-get": gcp_compute_network_get_command, "gcp-compute-image-get": gcp_compute_image_get, "gcp-compute-instance-group-get": gcp_compute_instance_group_get, "gcp-compute-region-get": gcp_compute_region_get, "gcp-compute-zone-get": gcp_compute_zone_get, "gcp-compute-networks-list": gcp_compute_networks_list, "gcp-compute-network-insert": gcp_compute_network_insert, # Storage commands "gcp-storage-bucket-list": storage_bucket_list, "gcp-storage-bucket-get": storage_bucket_get, "gcp-storage-bucket-objects-list": storage_bucket_objects_list, "gcp-storage-bucket-policy-list": storage_bucket_policy_list, "gcp-storage-bucket-policy-set": storage_bucket_policy_set, "gcp-storage-bucket-object-policy-list": storage_bucket_object_policy_list, "gcp-storage-bucket-object-policy-set": storage_bucket_object_policy_set, "gcp-storage-bucket-policy-delete": storage_bucket_policy_delete, "gcp-storage-bucket-metadata-update": storage_bucket_metadata_update, # Container (GKE) commands "gcp-container-cluster-security-update": container_cluster_security_update, # IAM commands "gcp-iam-project-policy-binding-remove": iam_project_policy_binding_remove, # BigQuery commands "gcp-bq-dataset-policy-remove": bq_dataset_policy_remove_command, # Quick Actions - Firewall "gcp-compute-firewall-patch-disable-gcp-default-firewall-rule-quick-action": compute_firewall_patch, # Quick Actions - Storage Bucket Policy "gcp-storage-bucket-policy-delete-remove-allusers-access-quick-action": storage_bucket_policy_delete, "gcp-storage-bucket-policy-delete-remove-AllAuthenticatedUser-access-quick-action": storage_bucket_policy_delete, "gcp-storage-bucket-policy-delete-make-gcp-bucket-private-quick-action": storage_bucket_policy_delete, # Quick Actions - Subnet Update "gcp-compute-subnet-update-enable-gcp-subnet-flow-logs-quick-action": compute_subnet_update, "gcp-compute-enable-private-ip-access-on-subnet-quick-action": compute_subnet_update, # Quick Actions - Container Cluster Security "gcp-container-cluster-security-update-enable-gke-cluster-intra-node-visibility-quick-action": container_cluster_security_update, # noqa E501 "gcp-container-cluster-security-update-enable-master-authorized-networks-on-gke-quick-action": container_cluster_security_update, # noqa E501 # Quick Actions - Storage Bucket Metadata "gcp-storage-bucket-metadata-update-enable-GCP-bucket-versioning-quick-action": storage_bucket_metadata_update, "gcp-storage-bucket-metadata-update-set-GCP-bucket-access-to-uniform-quick-action": storage_bucket_metadata_update, # The following commands are currently unsupported: # # Compute Engine commands # "gcp-compute-instance-metadata-add": compute_instance_metadata_add, # "gcp-iam-project-deny-policy-create": iam_project_deny_policy_create, # "gcp-iam-service-account-delete": iam_service_account_delete, # "gcp-iam-group-membership-delete": iam_group_membership_delete, # # Admin Directory commands # "gcp-admin-user-update": admin_user_update, # "gcp-admin-user-password-reset": admin_user_password_reset, # "gcp-admin-user-signout": admin_user_signout, } if command == "test-module" and (connector_id := get_connector_id()): demisto.debug(f"[GCP main] Running health check for connector ID: {connector_id}") return_results(run_health_check_for_accounts(connector_id, CloudTypes.GCP.value, health_check)) elif command in command_map: creds = get_credentials(args, params) return_results(command_map[command](creds, args)) else: raise NotImplementedError(f"Command not implemented: {command}") except HttpError as e: project_id = args.get("project_id") or args.get("folder_id") or "N/A" handle_permission_error(e, project_id, command) except Exception as e: return_error(f"Failed to execute command {demisto.command()}. Error: {str(e)}") if __name__ in ("__main__", "__builtin__", "builtins"): # pragma: no cover main()