启用和管理管理中心

本页面介绍了如何启用和管理管理中心

启用管理中心

命令行

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 使用 gcloud alpha storage management-hub enable 命令为项目、文件夹或组织启用管理中心。以下部分介绍了如何针对每种资源类型使用此命令。

    为项目启用管理中心

    gcloud alpha storage management-hub enable --project=PROJECT_ID

    其中:

    PROJECT_ID 是 Google Cloud 项目 ID。项目 ID 为字母数字,例如 my-project

    为文件夹启用管理中心

    gcloud alpha storage management-hub enable --sub-folder=FOLDER_ID

    其中:

    FOLDER_ID 是 Google Cloud 文件夹 ID。文件夹 ID 是数字,例如 123456789012

    为组织启用管理中心

    gcloud alpha storage management-hub enable --organization=ORGANIZATION_ID

    其中:

    ORGANIZATION_ID 是 Google Cloud 组织 ID。组织 ID 是数字,例如 123456789012

    如需应用基于名称的存储桶过滤条件,请使用以下标志:

    • --exclude-bucket-ids:要从管理中心方案中排除的存储桶 ID 的列表。
    • --exclude-bucket-regexes:要从管理中心方案中排除的存储桶 ID 正则表达式的列表。
    • --include-bucket-ids:要纳入管理中心方案的存储桶 ID 的列表。
    • --include-bucket-regexes:要纳入管理中心方案的存储桶 ID 正则表达式的列表。

    例如:

    $gcloud alpha storage management-hub enable --organization=my-org --exclude-bucket-ids="my-bucket" --exclude-bucket-regexes="my-bucket-.*"

    如需应用基于地点的存储桶过滤条件,请使用以下标志:

    • --exclude-locations:要从管理中心方案中排除的地点的列表。
    • --include-locations:要纳入管理中心方案的地点的列表。

    例如:

    $gcloud alpha storage management-hub enable --sub-folder=123456 --include-locations="us-east1","us-west1"

查看管理中心配置

本部分介绍如何查看某个资源的管理中心配置。

命令行

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 使用 gcloud alpha storage management-hub describe 命令查看项目、文件夹或组织的管理中心配置。以下部分介绍了如何针对每种资源类型使用此命令。

    查看项目的管理中心配置

    gcloud alpha storage management-hub describe --project=PROJECT_ID

    其中:

    PROJECT_ID 是 Google Cloud 项目 ID。项目 ID 为字母数字,例如 my-project

    查看文件夹的管理中心配置

    gcloud alpha storage management-hub view --sub-folder=FOLDER_ID

    其中:

    FOLDER_ID 是 Google Cloud 文件夹 ID。文件夹 ID 是数字,例如 123456789012

    查看组织的管理中心配置

    gcloud alpha storage management-hub describe --organization=ORGANIZATION_ID

    其中:

    ORGANIZATION_ID 是 Google Cloud 组织 ID。组织 ID 是数字,例如 123456789012

更新管理中心配置

本部分介绍如何更新某个资源的管理中心配置。

命令行

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 使用 gcloud alpha storage management-hub update 命令更新项目、文件夹或组织的管理中心配置。以下部分介绍了如何针对每种资源类型使用此命令。

    更新项目的管理中心配置

    gcloud alpha storage management-hub update --project=PROJECT_ID

    其中:

    PROJECT_ID 是 Google Cloud 项目 ID。项目 ID 为字母数字,例如 my-project

    更新文件夹的管理中心配置

    在开发环境中,运行以下命令:

    gcloud alpha storage management-hub update --sub-folder=FOLDER_ID

    其中:

    FOLDER_ID 是 Google Cloud 文件夹 ID。文件夹 ID 是数字,例如 123456789012

    更新组织的管理中心配置

    gcloud alpha storage management-hub update --organization=ORGANIZATION_ID

    其中:

    ORGANIZATION_ID 是 Google Cloud 组织 ID。组织 ID 是数字,例如 123456789012

    如需了解如何应用存储桶过滤条件,请参阅应用存储桶过滤条件

停用管理中心

本部分介绍如何停用管理中心。

命令行

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 使用 gcloud alpha storage management-hub disable 命令为项目、文件夹或组织停用管理中心。以下部分介绍了如何针对每种资源类型使用此命令。

    gcloud alpha storage management-hub disable --project=PROJECT_ID

    其中:

    PROJECT_ID 是 Google Cloud 项目 ID。项目 ID 为字母数字,例如 my-project

    为文件夹停用管理中心

    gcloud alpha storage management-hub disable --sub-folder=FOLDER_ID

    其中:

    FOLDER_ID 是 Google Cloud 文件夹 ID。文件夹 ID 是数字,例如 123456789012

    为组织停用管理中心

    gcloud alpha storage management-hub disable --organization=ORGANIZATION_ID

    其中:

    ORGANIZATION_ID 是 Google Cloud 组织 ID。组织 ID 是数字,例如 123456789012

后续步骤