Security Command Center 区域端点

本文档介绍了在启用数据驻留时如何使用 Security Command Center 资源。只有在为组织激活标准或高级服务层级时,您才能为 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 的标准或高级服务层级时启用数据驻留。它还可提供对特定位置的资源的访问权限。

使用管辖区级 Google Cloud 控制台有助于您在资源处于静态、使用中和传输中时对资源强制执行数据驻留控制措施

您可以使用管辖区级 Google Cloud 控制台仅访问受数据驻留控制措施约束的资源类型。如需打开控制台,请使用适合您所在位置的网址:

欧盟
联合身份用户console.eu.cloud.google
所有其他用户: console.eu.cloud.google.com
沙特阿拉伯王国 (KSA)
联合身份用户: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
沙特阿拉伯王国 (KSA)
me-central2
美国
us

Model Armor API 的位置

Model Armor API 在以下位置提供区域级端点:

欧盟
europe-west4:荷兰 叶形图标 二氧化碳排放量低
美国
us-central1:艾奥瓦 叶形图标 二氧化碳排放量低
us-east1:南卡罗来纳
us-east4:北弗吉尼亚
us-west1:俄勒冈 叶形图标 二氧化碳排放量低

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:要配置的服务;对于 Model Armor API,使用 modelarmor;对于 Security Command Center API,使用 securitycenter
  • 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 替换为该服务的受支持位置

对于所有其他资源类型,您必须使用默认端点。