Security Command Center 區域端點

本文說明啟用資料落地設定後,如何使用 Security Command Center 資源。只有在為機構啟用 Standard 或 Premium 服務方案時,才能為 Security Command Center 啟用資料落地設定。

有資料落地權控制項的資源

下列 Security Command Center 資源類型適用資料落地控制選項

如要在程式輔助或指令列中處理這些資源,請使用 Security Command Center API 的區域端點。如要在 Google Cloud 控制台中使用這些資源,請務必使用管轄區 Google Cloud 控制台

如為其他資源類型,請使用預設 API 端點和Google Cloud 控制台

關於區域端點

區域端點可存取特定位置的資源。使用地區端點時,要求會直接傳送至端點的位置。您無法使用區域端點存取其他位置的資源。

使用區域端點有助於在資源處於閒置、使用中和傳輸狀態時,強制執行資料落地控制項

Security Command Center 包含多項服務。如果是受資料落地控制選項限制的資源類型,下列服務必須使用區域端點:

Model Armor API
modelarmor.LOCATION.rep.googleapis.com
Security Command Center API
securitycenter.LOCATION.rep.googleapis.com

LOCATION 替換為服務的支援位置

對於所有其他資源類型,您必須使用預設端點。

關於管轄區 Google Cloud 控制台

您可以在管轄區 Google Cloud 控制台中,啟用 Security Command Center 的 Standard 或 Premium 服務級別時,一併啟用資料落地設定。並提供特定位置的資源存取權。

使用管轄區 Google Cloud 控制台,有助於在資源處於靜態、使用中和傳輸狀態時,強制執行資料落地控制項

您只能使用管轄區 Google Cloud 控制台,存取受資料落地控管的資源類型。如要開啟控制台,請使用您所在位置的適當網址:

歐盟
聯合身分識別使用者console.eu.cloud.google
所有其他使用者: console.eu.cloud.google.com
沙烏地阿拉伯王國
採聯合驗證的身分使用者: console.sa.cloud.google
所有其他使用者: console.sa.cloud.google.com
美國
採聯合驗證的身分使用者: console.us.cloud.google
所有其他使用者: console.us.cloud.google.com

如要使用所有其他資源類型,請務必使用標準 Google Cloud 控制台。

區域端點的位置

本節列出 Security Command Center API 和相關服務的區域端點適用位置。

Security Command Center API 的位置

Security Command Center API 在下列位置提供區域和多區域端點:

歐盟
eu
沙烏地阿拉伯王國
me-central2
美國
us

Model Armor API 的位置

Model Armor API 在下列位置提供區域端點:

歐盟
europe-west4:荷蘭 節能綠葉圖示 二氧化碳排放量低2
美國
us-central1:愛荷華州 節能綠葉圖示 低二氧化碳
us-east1:南卡羅來納州
us-east4:北維吉尼亞州
us-west1:奧勒岡州 <0
節能綠葉圖示

Model Armor API 在下列位置提供多區域端點:

歐盟
eu
美國
us

區域端點工具

如要管理受資料落地控制選項限制的資源類型,您必須在建立用戶端或執行指令時指定區域端點。

對於所有其他資源類型,您必須使用預設端點。

gcloud

下列 gcloud CLI 指令群組需要使用區域端點:

對於所有其他 gcloud scc 指令群組,您必須使用 Security Command Center API 的預設端點。

變更服務端點

如要切換至區域端點,請執行下列指令:

gcloud config set api_endpoint_overrides/SERVICE \
    https://SERVICE.LOCATION.rep.googleapis.com/

如要切換至預設端點,請執行下列指令:

gcloud config unset api_endpoint_overrides/SERVICE

更改下列內容:

  • SERVICE:要設定的服務;使用 modelarmor 適用於 Model Armor API,或使用 securitycenter 適用於 Security Command Center API
  • LOCATION:服務支援的位置

您也可以選擇為 gcloud CLI 建立使用區域端點的具名設定。執行 gcloud CLI 指令前,您可以執行 gcloud config configurations activate 指令,切換至具名設定。

執行 gcloud CLI 指令

執行 Security Command Center API 的 gcloud CLI 指令時,請務必指定位置。做法如下:

  • 使用 --location 標記。
  • 如果您提供資源名稱的完整路徑,請使用指定位置的格式,例如 projects/123/sources/456/locations/LOCATION/findings/a1b2c3

下列範例說明如何使用 --location 旗標。

gcloud scc findings list 指令會列出特定位置的機構發現項目。

使用下方的任何指令資料之前,請先替換以下項目:

  • ORGANIZATION_ID:機構的數值 ID
  • LOCATION:Security Command Center API 的支援位置

執行 gcloud scc findings list 指令:

Linux、macOS 或 Cloud Shell

gcloud scc findings list ORGANIZATION_ID --location=LOCATION

Windows (PowerShell)

gcloud scc findings list ORGANIZATION_ID --location=LOCATION

Windows (cmd.exe)

gcloud scc findings list ORGANIZATION_ID --location=LOCATION

回應會包含調查結果清單。

Terraform

如要瞭解如何套用或移除 Terraform 設定,請參閱「基本 Terraform 指令」。 詳情請參閱 Terraform供應商參考說明文件

provider "google" {
  alias                              = "securitycenter_v2_endpoint_us"
  security_center_v2_custom_endpoint = "https://securitycenter.us.rep.googleapis.com/v2/"
}

Go

請使用下列其中一個區域端點:

Model Armor API
modelarmor.LOCATION.rep.googleapis.com:443
Security Command Center API
securitycenter.LOCATION.rep.googleapis.com:443

LOCATION 替換為服務的支援位置

以下程式碼範例說明如何建立使用區域端點的 Security Command Center API 用戶端。

import (
	"context"
	"fmt"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"google.golang.org/api/option"
)

// createClientWithEndpoint creates a Security Command Center client for a
// regional endpoint.
func createClientWithEndpoint(repLocation string) error {
	// Assemble the regional endpoint URL using provided location.
	repEndpoint := fmt.Sprintf("securitycenter.%s.rep.googleapis.com:443", repLocation)
	// Instantiate client for regional endpoint. Use this client to access resources that
	// are subject to data residency controls, and that are located in the region
	// specified in repLocation.
	repCtx := context.Background()
	repClient, err := securitycenter.NewClient(repCtx, option.WithEndpoint(repEndpoint))
	if err != nil {
		return err
	}
	defer repClient.Close()

	return nil
}

Java

請使用下列其中一個區域端點:

Model Armor API
modelarmor.LOCATION.rep.googleapis.com:443
Security Command Center API
securitycenter.LOCATION.rep.googleapis.com:443

LOCATION 替換為服務的支援位置

以下程式碼範例說明如何建立使用區域端點的 Security Command Center API 用戶端。


import com.google.cloud.securitycenter.v2.SecurityCenterClient;
import com.google.cloud.securitycenter.v2.SecurityCenterSettings;
import java.io.IOException;

public class CreateClientWithEndpoint {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the value with the endpoint for the region in which your
    // Security Command Center data resides.
    String regionalEndpoint = "securitycenter.me-central2.rep.googleapis.com:443";
    SecurityCenterClient client = createClientWithEndpoint(regionalEndpoint);
    System.out.println("Client initiated with endpoint: " + client.getSettings().getEndpoint());
  }

  // Creates Security Command Center client for a regional endpoint.
  public static SecurityCenterClient createClientWithEndpoint(String regionalEndpoint)
      throws java.io.IOException {
    SecurityCenterSettings regionalSettings =
        SecurityCenterSettings.newBuilder().setEndpoint(regionalEndpoint).build();
    return SecurityCenterClient.create(regionalSettings);
  }
}

Python

請使用下列其中一個區域端點:

Model Armor API
modelarmor.LOCATION.rep.googleapis.com
Security Command Center API
securitycenter.LOCATION.rep.googleapis.com

LOCATION 替換為服務的支援位置

以下程式碼範例說明如何建立使用區域端點的 Security Command Center API 用戶端。

from google.cloud import securitycenter_v2


def create_client_with_endpoint(api_endpoint) -> securitycenter_v2.SecurityCenterClient:
    """
    Creates a Security Command Center client for a regional endpoint.
    Args:
        api_endpoint: the regional endpoint's hostname, like 'securitycenter.REGION.rep.googleapis.com'
    Returns:
        securitycenter_v2.SecurityCenterClient: returns a client for the regional endpoint
    """
    regional_client = securitycenter_v2.SecurityCenterClient(
        client_options={"api_endpoint": api_endpoint}
    )
    print(
        "Regional client initiated with endpoint: {}".format(
            regional_client.api_endpoint
        )
    )
    return regional_client

REST

如要存取下列 REST API 資源類型,必須使用區域服務端點:

Model Armor API

端點: https://modelarmor.LOCATION.rep.googleapis.com

LOCATION 替換為服務的支援位置

資源類型:所有資源類型

Security Command Center API

端點: https://securitycenter.LOCATION.rep.googleapis.com

LOCATION 替換為服務的支援位置

資源類型:

LOCATION 替換為服務的支援位置

對於所有其他資源類型,您必須使用預設端點。