Add a Google Cloud Platform Connector

You can use the SDK to add a Google Cloud Platform (GCP) connector and sync virtual machines (VMs) from GCP to Deep Security Manager. For an overview, see this article in the Deep Security Help Center.

Prerequisite: You must prepare a GCP service account for use with Deep Security.

Use the following procedure to add a GCP connector:

  1. Create a GcpConnector object and set the name and service account. The name and service account are required properties. The length of the name cannot exceed 255 characters.
  2. Create a GcpConnectorsApi object and use it to create the GcpConnector on Deep Security Manager.

To see the properties that you can configure, see the Create a Computer operation in the API reference

View source
def create_gcp_connector(api, configuration, api_version, api_exception, name, service_account):
   api_instance = api.GCPConnectorsApi(api.ApiClient(configuration))
   gcp_connector = api.GCPConnector() = name
   gcp_connector.service_account = service_account

   api_response = api_instance.create_gcp_connector(gcp_connector, api_version)
   return api_response
View source
exports.createGcpConnector = function(api, name, serviceAccount, apiVersion){
    let apiInstance = new api.GCPConnectorsApi();
    let gcpConnector = new api.GCPConnector();

    // Set the GCP connector properties. = name;
    gcpConnector.serviceAccount = serviceAccount;
    return apiInstance.createGCPConnector(gcpConnector, apiVersion);
View source
public static GCPConnector createGcpConnector(String name, String serviceAccount, String apiVersion)
      throws ApiException {

   GcpConnectorsApi apiInstance = new GcpConnectorsApi();

   // Create a GCP connector
   GCPConnector gcpConnector = new GCPConnector();

   // Add a GCP connector to Deep Security Manager
   GCPConnector result = null;
   result = apiInstance.createGCPConnector(gcpConnector, apiVersion);

   return result;

Submit a Sync Action for a GCP Connector

After you create a GCP connector successfully, you can indicate to the GCP connector to trigger a sync.

Use the following high-level procedure to submit a sync action:

  1. Create an Action object and set the type to "synchronize". The type is a required property.
  2. Create a GcpConnectorActionsApi object and use it to submit an action by a specific GCP connector ID to Deep Security Manager.
View source
def create_gcp_connector_action(api, configuration, api_version, api_exception, gcp_connector_id):
   api_instance = api.GCPConnectorActionsApi(api.ApiClient(configuration))
   gcp_connector_action = api.Action()
   gcp_connector_action.type = "synchronize"

   api_response = api_instance.create_gcp_connector_action(gcp_connector_id, gcp_connector_action, api_version)
   return api_response
View source
exports.createGcpConnectorAction = function(api, gcpConnectorID, apiVersion){
    let apiInstance = new api.GCPConnectorActionsApi();

    // Set the action.
    let gcpConnectorAction = new api.Action();
    gcpConnectorAction.type = "synchronize";
    return apiInstance.createGCPConnectorAction(gcpConnectorID, gcpConnectorAction, apiVersion);
View source
public static Action createGCPConnectorAction(Integer gcpConnectorID, String apiVersion) throws ApiException {
    GcpConnectorActionsApi apiInstance = new GcpConnectorActionsApi();

    // Set up synchronize action
    Action gcpConnectorAction = new Action();
    Action result = apiInstance.createGCPConnectorAction(gcpConnectorID, gcpConnectorAction, apiVersion);

    return result;