管理項目及擷取自訂來源

本文說明如何將專屬自訂資料來源的相關資訊匯入 Dataplex Universal Catalog。

Dataplex Universal Catalog 可做為所有資料資產的中央登錄檔。如要整合自訂來源,您需要三個重要元件:

  • 項目群組:這是安全容器,可存放自訂資料記錄。 這就像是資料夾,可定義記錄的存取權限和地理位置 (區域)。

  • 項目類型:這會做為範本或結構定義。這項功能會為特定類型的資料資產定義必要的中繼資料欄位 (例如資料擁有者、更新頻率或品質分數)。

  • 項目:這是指個別記錄或資產本身 (例如特定專有檔案或資料庫表格)。

整合程序

如要註冊自訂資料來源,請設定以下結構:

  1. 建立項目群組 (資料夾)。

  2. 定義項目類型 (範本/結構)。

  3. 使用資料夾中的範本建立自訂項目 (資料記錄)。

實體

項目代表您要擷取中繼資料的資料資產。每個項目都是項目類型的執行個體。項目切面的每項作業都必須符合項目類型所需的切面。舉例來說,建立項目時,您必須為項目類型定義的所有切面類型提供值。如果項目類型中標示為 required,您就無法刪除該項目的這些層面。

項目類別

  • 系統項目:Dataplex Universal Catalog 會為資源建立項目,例如 BigQuery 資料集或資料表。 Google Cloud Dataplex Universal Catalog 建立的項目稱為系統項目。Dataplex Universal Catalog 會持續從支援的 Google Cloud 系統同步處理中繼資料,自動更新系統項目。

    系統項目會自動填入中繼資料 (稱為必要面向),您無法修改。您只能使用選用切面,為系統項目新增及修改額外中繼資料。詳情請參閱「面向類別」。

  • 自訂項目:您可以為自訂資源建立及管理項目,這類項目稱為自訂項目。自訂資源是指非 Google 服務中的資源,這些資源代管於 Google Cloud 或外部 (例如內部部署)。

項目群組

項目群組是項目的容器,您可以使用項目群組管理項目的存取控管機制和區域位置。每個項目群組都屬於專案。

項目群組類別

  • 系統項目群組:針對 Google Cloud 資源,Dataplex Universal Catalog 會在每個專案和資源所在位置,為每個系統自動建立項目群組。舉例來說,@bigquery 是 BigQuery 的系統項目群組。

  • 自訂項目群組:您為自訂資源建立的項目群組。

項目類型

項目類型會使用一組必要切面類型,定義這類項目所需的必要中繼資料。

您只能在項目中指定必要切面類型,無法在項目的資料欄中指定。建立特定項目類型的項目時,您必須提供項目類型指定的所有必要切面類型值。

項目類型中參照的必要切面類型必須與項目類型位於相同專案。

項目類型類別

  • 自訂項目類型:您建立及管理的項目類型。您可以使用這些項目類型建立自訂項目。

  • 系統項目類型:Dataplex Universal Catalog 預設會提供這些項目類型。系統項目類型可進一步分為可重複使用和受限類型。

    下表說明系統項目類型的類別,以及 Dataplex Universal Catalog 為每個類別提供的項目類型清單:

    系統登錄類型類別 說明 Dataplex Universal Catalog 提供的項目類型
    可重複使用的系統項目類型 您可以使用這個項目類型建立自訂項目。
    • generic
    受限的系統項目類型 這些保留字供系統使用,例如為Google Cloud 資源建立項目。

    您無法使用這些項目類型建立項目,但可以編輯這些項目類型的項目,新增選用切面。
    包括但不限於:
    • analytics-hub-exchange
    • analytics-hub-listing
    • aspecttype
    • bigquery-dataset
    • bigquery-table
    • cloudsql-database
    • cloudsql-instance
    • cloudsql-table
    • entrygroup
    • entrytype
    • sql-access
    • storage
    • storage-bucket
    • storage-folder

您可以在特定區域位置建立自訂項目類型,也可以建立全域資源。項目類型的位置會影響其適用範圍。詳情請參閱「專案和位置限制」。

系統項目類型一律為全域類型。系統項目類型會儲存在專案 ID 為 655216118709 的 Google 管理專案中。例如:projects/655216118709/locations/global/entryTypes/bigquery-table

事前準備

管理項目和擷取自訂資料來源之前,請務必先完成本節所述工作。

必要的角色

如要取得建立及管理項目所需的權限,請要求管理員在資源中授予您下列 IAM 角色:

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

詳情請參閱「Dataplex Universal Catalog IAM 角色」。

啟用 API

在 Dataplex Universal Catalog 專案中啟用 Dataplex API。

啟用 API

建立項目群組

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「Catalog」(目錄) 頁面

  2. 按一下「項目群組」>「自訂」分頁標籤。

  3. 按一下「建立項目群組 (Dataplex Universal Catalog)」

  4. 在「建立項目群組」視窗中,輸入下列內容:

    1. 選用:在「顯示名稱」欄位中,輸入項目群組的顯示名稱。
    2. 項目群組 ID:輸入項目群組的專屬 ID。
    3. 選用:在「Description」(說明) 欄位中輸入項目群組的說明。
    4. 位置:選取位置。建立項目群組後,您就無法修改位置。
  5. 選用:在「標籤」部分,以鍵/值組合的形式為資源新增任意標籤:

    1. 按一下「新增標籤」
    2. 在「Key」欄位中輸入金鑰。
    3. 在「Value」(值) 欄位中,輸入金鑰的值。
    4. 如要新增更多標籤,請按一下「新增標籤」,然後重複上述步驟。
  6. 按一下 [儲存]

gcloud

如要建立項目群組,請使用 gcloud dataplex entry-groups create 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using Google.LongRunning;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for CreateEntryGroup</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateEntryGroupRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        CreateEntryGroupRequest request = new CreateEntryGroupRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            EntryGroupId = "",
            EntryGroup = new EntryGroup(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<EntryGroup, OperationMetadata> response = catalogServiceClient.CreateEntryGroup(request);

        // Poll until the returned long-running operation is complete
        Operation<EntryGroup, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        EntryGroup result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<EntryGroup, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceCreateEntryGroup(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            EntryGroup retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateEntryGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateEntryGroupRequest.
	}
	op, err := c.CreateEntryGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.CreateEntryGroupRequest;
import com.google.cloud.dataplex.v1.EntryGroup;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateEntryGroup {

  public static void main(String[] args) throws Exception {
    syncCreateEntryGroup();
  }

  public static void syncCreateEntryGroup() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      CreateEntryGroupRequest request =
          CreateEntryGroupRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setEntryGroupId("entryGroupId1228924712")
              .setEntryGroup(EntryGroup.newBuilder().build())
              .setValidateOnly(true)
              .build();
      EntryGroup response = catalogServiceClient.createEntryGroupAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_entry_group():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.CreateEntryGroupRequest(
        parent="parent_value",
        entry_group_id="entry_group_id_value",
    )

    # Make the request
    operation = client.create_entry_group(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the create_entry_group call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#create_entry_group.
#
def create_entry_group
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::CreateEntryGroupRequest.new

  # Call the create_entry_group method.
  result = client.create_entry_group request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要建立項目群組,請使用 entryGroups.Create 方法。

建立項目類型

如要擷取新來源,必須建立項目類型。

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「Catalog」(目錄) 頁面

  2. 按一下「項目類型」>「自訂」分頁標籤。

  3. 點選「建立」

  4. 在「建立項目類型」視窗中,輸入下列內容:

    1. 選用:在「顯示名稱」欄位中,輸入項目類型的顯示名稱。
    2. 項目類型 ID:輸入項目類型的專屬 ID。項目類型建立完成後,即無法修改這項設定。
    3. 選用:在「Description」(說明) 欄位中輸入項目類型的說明。
    4. 選用:在「系統」欄位中輸入來源系統。
    5. 選用:在「平台」欄位中,輸入這類項目所屬的平台。例如:Google Cloud
    6. 在「Location」(位置) 欄位中,選取位置。建立項目類型後,就無法修改位置。
  5. 選用:在「類型別名」部分,定義項目類型的資料類型。資料類型可用於查詢項目。

    1. 按一下「新增型別別名」
    2. 在「型別別名」欄位中選取資料型別。您可以新增多個型別別名。
  6. 在「必要切面類型」部分,選取這個項目類型必須具備的切面類型。依據這個類型建立的各個項目都會獲派這些必要切面類型。建立項目類型後,就無法修改必要切面類型清單。

    1. 按一下「選擇切面類型」
    2. 在「選取切面類型」視窗中,選取切面類型。
    3. 按一下「選取」

    你無法從項目中刪除必要面向。

  7. 選用:在「標籤」部分,以鍵/值組合的形式為資源新增任意標籤:

    1. 按一下「新增標籤」
    2. 在「Key」欄位中輸入金鑰。
    3. 在「Value」(值) 欄位中,輸入金鑰的值。
    4. 如要新增更多標籤,請按一下「新增標籤」,然後重複上述步驟。
  8. 按一下 [儲存]

gcloud

如要建立項目類型,請使用 gcloud dataplex entry-types create 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using Google.LongRunning;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for CreateEntryType</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateEntryTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        CreateEntryTypeRequest request = new CreateEntryTypeRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            EntryTypeId = "",
            EntryType = new EntryType(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<EntryType, OperationMetadata> response = catalogServiceClient.CreateEntryType(request);

        // Poll until the returned long-running operation is complete
        Operation<EntryType, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        EntryType result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<EntryType, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceCreateEntryType(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            EntryType retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateEntryTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateEntryTypeRequest.
	}
	op, err := c.CreateEntryType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.CreateEntryTypeRequest;
import com.google.cloud.dataplex.v1.EntryType;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateEntryType {

  public static void main(String[] args) throws Exception {
    syncCreateEntryType();
  }

  public static void syncCreateEntryType() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      CreateEntryTypeRequest request =
          CreateEntryTypeRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setEntryTypeId("entryTypeId-1105721081")
              .setEntryType(EntryType.newBuilder().build())
              .setValidateOnly(true)
              .build();
      EntryType response = catalogServiceClient.createEntryTypeAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_entry_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.CreateEntryTypeRequest(
        parent="parent_value",
        entry_type_id="entry_type_id_value",
    )

    # Make the request
    operation = client.create_entry_type(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the create_entry_type call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#create_entry_type.
#
def create_entry_type
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::CreateEntryTypeRequest.new

  # Call the create_entry_type method.
  result = client.create_entry_type request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要建立項目類型,請使用 entryTypes.create 方法。

建立自訂項目

建立自訂項目之前,請先建立項目群組項目類型

控制台

系統不支援使用 Google Cloud 控制台建立自訂項目。請改用 Google Cloud CLI 或 API。

gcloud

如要建立自訂項目,請使用 gcloud dataplex entries create 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for CreateEntry</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        CreateEntryRequest request = new CreateEntryRequest
        {
            ParentAsEntryGroupName = EntryGroupName.FromProjectLocationEntryGroup("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"),
            EntryId = "",
            Entry = new Entry(),
        };
        // Make the request
        Entry response = catalogServiceClient.CreateEntry(request);
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateEntryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateEntryRequest.
	}
	resp, err := c.CreateEntry(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.CreateEntryRequest;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.EntryGroupName;

public class SyncCreateEntry {

  public static void main(String[] args) throws Exception {
    syncCreateEntry();
  }

  public static void syncCreateEntry() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      CreateEntryRequest request =
          CreateEntryRequest.newBuilder()
              .setParent(EntryGroupName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]").toString())
              .setEntryId("entryId-1591558867")
              .setEntry(Entry.newBuilder().build())
              .build();
      Entry response = catalogServiceClient.createEntry(request);
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_entry():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    entry = dataplex_v1.Entry()
    entry.entry_type = "entry_type_value"

    request = dataplex_v1.CreateEntryRequest(
        parent="parent_value",
        entry_id="entry_id_value",
        entry=entry,
    )

    # Make the request
    response = client.create_entry(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the create_entry call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#create_entry.
#
def create_entry
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::CreateEntryRequest.new

  # Call the create_entry method.
  result = client.create_entry request

  # The returned object is of type Google::Cloud::Dataplex::V1::Entry.
  p result
end

REST

如要建立自訂項目,請使用 entries.create 方法。

建立自訂項目後,即可在項目中新增切面。詳情請參閱「為項目新增層面」。

管理項目群組

本節說明如何查看可用項目群組清單、查看詳細資料、更新及刪除項目群組。

查看可用的項目群組清單

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「Catalog」(目錄) 頁面

  2. 按一下「項目群組」分頁標籤。

    這個頁面會列出所有可用的 Dataplex Universal Catalog 和 Data Catalog 項目群組。

  3. 如要查看自訂項目群組,請按一下「自訂」分頁標籤。在「自訂」分頁中,「目錄來源」欄會顯示資源所在位置,也就是 Dataplex Universal Catalog 或 Data Catalog。

    如要查看系統項目群組,請按一下「系統」分頁標籤。

    如要進一步瞭解自訂和系統輸入群組,請參閱本文的「輸入群組類別」一節。

  4. 選用:如要查看所選專案中的項目群組清單,請按一下「自訂」分頁,然後將「顯示所有專案的項目」切換鈕設為關閉。

    「顯示所有專案的資源」切換鈕預設為開啟,清單會包含所選機構的 Dataplex Universal Catalog 資源,以及您可存取的所有機構的 Data Catalog 資源。

gcloud

如要查看可用項目群組清單,請使用 gcloud dataplex entry-groups list 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Api.Gax;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using System;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for ListEntryGroups</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void ListEntryGroupsRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        ListEntryGroupsRequest request = new ListEntryGroupsRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Filter = "",
            OrderBy = "",
        };
        // Make the request
        PagedEnumerable<ListEntryGroupsResponse, EntryGroup> response = catalogServiceClient.ListEntryGroups(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (EntryGroup item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        foreach (ListEntryGroupsResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (EntryGroup item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<EntryGroup> singlePage = response.ReadPage(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (EntryGroup item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.ListEntryGroupsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListEntryGroupsRequest.
	}
	it := c.ListEntryGroups(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*dataplexpb.ListEntryGroupsResponse)
	}
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryGroup;
import com.google.cloud.dataplex.v1.ListEntryGroupsRequest;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncListEntryGroups {

  public static void main(String[] args) throws Exception {
    syncListEntryGroups();
  }

  public static void syncListEntryGroups() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      ListEntryGroupsRequest request =
          ListEntryGroupsRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (EntryGroup element : catalogServiceClient.listEntryGroups(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_list_entry_groups():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.ListEntryGroupsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_entry_groups(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the list_entry_groups call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#list_entry_groups.
#
def list_entry_groups
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::ListEntryGroupsRequest.new

  # Call the list_entry_groups method.
  result = client.list_entry_groups request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Dataplex::V1::EntryGroup.
    p item
  end
end

REST

如要查看可用項目群組清單,請使用 entryGroups.list 方法。

查看項目群組的詳細資料

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「目錄」

  2. 按一下「項目群組」分頁標籤。

  3. 按一下要查看詳細資料的項目群組。

    項目群組詳細資料頁面隨即開啟。您可以存取所選項目群組的資訊,例如顯示名稱、項目群組 ID、說明、專案 ID、位置、標籤、建立日期和上次修改日期。

    如果是 Data Catalog 項目群組,您可以在 Data Catalog 和 Dataplex Universal Catalog 網頁介面中查看詳細資料。如要這麼做,請在項目群組詳細資料頁面中,按一下「Data Catalog」或「Dataplex Universal Catalog」

    「項目樣本」部分會顯示所選項目群組中最近建立的 10 個相關項目。

  4. 選用:如要查看與項目群組相關的所有項目,請在「樣本項目」部分中,按一下「在搜尋結果顯示所有相關項目」

gcloud

如要擷取項目群組的詳細資料,請使用 gcloud dataplex entry-groups describe 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for GetEntryGroup</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void GetEntryGroupRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        GetEntryGroupRequest request = new GetEntryGroupRequest
        {
            EntryGroupName = EntryGroupName.FromProjectLocationEntryGroup("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"),
        };
        // Make the request
        EntryGroup response = catalogServiceClient.GetEntryGroup(request);
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.GetEntryGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#GetEntryGroupRequest.
	}
	resp, err := c.GetEntryGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryGroup;
import com.google.cloud.dataplex.v1.EntryGroupName;
import com.google.cloud.dataplex.v1.GetEntryGroupRequest;

public class SyncGetEntryGroup {

  public static void main(String[] args) throws Exception {
    syncGetEntryGroup();
  }

  public static void syncGetEntryGroup() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      GetEntryGroupRequest request =
          GetEntryGroupRequest.newBuilder()
              .setName(EntryGroupName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]").toString())
              .build();
      EntryGroup response = catalogServiceClient.getEntryGroup(request);
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_get_entry_group():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.GetEntryGroupRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_entry_group(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the get_entry_group call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#get_entry_group.
#
def get_entry_group
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::GetEntryGroupRequest.new

  # Call the get_entry_group method.
  result = client.get_entry_group request

  # The returned object is of type Google::Cloud::Dataplex::V1::EntryGroup.
  p result
end

REST

如要擷取項目群組的詳細資料,請使用 entryGroups.get 方法。

更新項目群組

您可以更新自訂項目群組。系統項目群組無法修改。

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「目錄」

  2. 按一下「項目群組」>「自訂」分頁標籤。

  3. 按一下要更新的項目群組。

  4. 在「項目群組詳細資料」頁面中,按一下「編輯」

  5. 視需要編輯顯示名稱、說明和標籤。

  6. 按一下 [儲存]

gcloud

如要更新項目群組,請使用 gcloud dataplex entry-groups update 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntryGroup</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void UpdateEntryGroupRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryGroupRequest request = new UpdateEntryGroupRequest
        {
            EntryGroup = new EntryGroup(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<EntryGroup, OperationMetadata> response = catalogServiceClient.UpdateEntryGroup(request);

        // Poll until the returned long-running operation is complete
        Operation<EntryGroup, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        EntryGroup result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<EntryGroup, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceUpdateEntryGroup(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            EntryGroup retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.UpdateEntryGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryGroupRequest.
	}
	op, err := c.UpdateEntryGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryGroup;
import com.google.cloud.dataplex.v1.UpdateEntryGroupRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateEntryGroup {

  public static void main(String[] args) throws Exception {
    syncUpdateEntryGroup();
  }

  public static void syncUpdateEntryGroup() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      UpdateEntryGroupRequest request =
          UpdateEntryGroupRequest.newBuilder()
              .setEntryGroup(EntryGroup.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      EntryGroup response = catalogServiceClient.updateEntryGroupAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_update_entry_group():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.UpdateEntryGroupRequest()

    # Make the request
    operation = client.update_entry_group(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_entry_group call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#update_entry_group.
#
def update_entry_group
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::UpdateEntryGroupRequest.new

  # Call the update_entry_group method.
  result = client.update_entry_group request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要更新項目群組,請使用 entryGroups.patch 方法。

刪除項目群組

您可以刪除自訂項目群組,無法刪除系統項目群組。

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「Catalog」(目錄) 頁面

  2. 按一下「項目群組」>「自訂」分頁標籤。

  3. 按一下要刪除的項目群組。

  4. 在「Entry group details」(項目群組詳細資料) 頁面中,按一下「Delete」(刪除)。當系統提示時,確認刪除。

gcloud

如要刪除項目群組,請使用 gcloud dataplex entry-groups delete 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for DeleteEntryGroup</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void DeleteEntryGroupRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        DeleteEntryGroupRequest request = new DeleteEntryGroupRequest
        {
            EntryGroupName = EntryGroupName.FromProjectLocationEntryGroup("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"),
            Etag = "",
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = catalogServiceClient.DeleteEntryGroup(request);

        // Poll until the returned long-running operation is complete
        Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Empty result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Empty, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceDeleteEntryGroup(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Empty retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.DeleteEntryGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteEntryGroupRequest.
	}
	op, err := c.DeleteEntryGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.DeleteEntryGroupRequest;
import com.google.cloud.dataplex.v1.EntryGroupName;
import com.google.protobuf.Empty;

public class SyncDeleteEntryGroup {

  public static void main(String[] args) throws Exception {
    syncDeleteEntryGroup();
  }

  public static void syncDeleteEntryGroup() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      DeleteEntryGroupRequest request =
          DeleteEntryGroupRequest.newBuilder()
              .setName(EntryGroupName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]").toString())
              .setEtag("etag3123477")
              .build();
      catalogServiceClient.deleteEntryGroupAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_delete_entry_group():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.DeleteEntryGroupRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_entry_group(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the delete_entry_group call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#delete_entry_group.
#
def delete_entry_group
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::DeleteEntryGroupRequest.new

  # Call the delete_entry_group method.
  result = client.delete_entry_group request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要刪除項目群組,請使用 entryGroups.delete 方法。

管理項目類型

本節說明如何查看可用項目群組清單、查看詳細資料、更新及刪除項目類型。

查看可用的項目類型清單

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「目錄」

  2. 按一下「項目類型」分頁標籤。

  3. 如要查看自訂項目類型,請按一下「自訂」分頁標籤。如要查看系統項目類型,請按一下「系統」分頁標籤。如要進一步瞭解自訂和系統項目類型,請參閱本文的「項目類型類別」一節。

  4. 選用步驟:如要查看所選專案中的項目類型清單,請按一下「自訂」分頁標籤,然後將「顯示所有專案的項目」切換鈕設為關閉。

    「顯示所有專案」切換按鈕預設為開啟,清單會包含所有專案的項目類型。

gcloud

如要查看可用項目類型清單,請使用 gcloud dataplex entry-types list 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Api.Gax;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using System;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for ListEntryTypes</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void ListEntryTypesRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        ListEntryTypesRequest request = new ListEntryTypesRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Filter = "",
            OrderBy = "",
        };
        // Make the request
        PagedEnumerable<ListEntryTypesResponse, EntryType> response = catalogServiceClient.ListEntryTypes(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (EntryType item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        foreach (ListEntryTypesResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (EntryType item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<EntryType> singlePage = response.ReadPage(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (EntryType item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.ListEntryTypesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListEntryTypesRequest.
	}
	it := c.ListEntryTypes(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*dataplexpb.ListEntryTypesResponse)
	}
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryType;
import com.google.cloud.dataplex.v1.ListEntryTypesRequest;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncListEntryTypes {

  public static void main(String[] args) throws Exception {
    syncListEntryTypes();
  }

  public static void syncListEntryTypes() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      ListEntryTypesRequest request =
          ListEntryTypesRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (EntryType element : catalogServiceClient.listEntryTypes(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_list_entry_types():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.ListEntryTypesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_entry_types(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the list_entry_types call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#list_entry_types.
#
def list_entry_types
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::ListEntryTypesRequest.new

  # Call the list_entry_types method.
  result = client.list_entry_types request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Dataplex::V1::EntryType.
    p item
  end
end

REST

如要查看可用項目類型清單,請使用 entryTypes.list 方法。

查看項目類型詳細資料

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「目錄」

  2. 按一下「項目類型」> 自訂分頁標籤。

  3. 按一下要查看詳細資料的項目類型。

    系統會開啟項目類型詳細資料頁面。您可以存取所選項目類型的資訊,例如顯示名稱、項目類型 ID、說明、專案 ID、位置、平台、系統、類型別名、標籤、建立日期和上次修改日期。

  4. 選用:如要查看最近建立的 10 個相關項目清單,請按一下「範例項目」分頁標籤。

  5. 選用:如要查看與項目群組相關的所有項目,請按一下「樣本項目」分頁標籤,然後點選「在搜尋結果顯示所有相關項目」

gcloud

如要擷取項目類型的詳細資料,請使用 gcloud dataplex entry-types describe 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for GetEntryType</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void GetEntryTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        GetEntryTypeRequest request = new GetEntryTypeRequest
        {
            EntryTypeName = EntryTypeName.FromProjectLocationEntryType("[PROJECT]", "[LOCATION]", "[ENTRY_TYPE]"),
        };
        // Make the request
        EntryType response = catalogServiceClient.GetEntryType(request);
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.GetEntryTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#GetEntryTypeRequest.
	}
	resp, err := c.GetEntryType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryType;
import com.google.cloud.dataplex.v1.EntryTypeName;
import com.google.cloud.dataplex.v1.GetEntryTypeRequest;

public class SyncGetEntryType {

  public static void main(String[] args) throws Exception {
    syncGetEntryType();
  }

  public static void syncGetEntryType() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      GetEntryTypeRequest request =
          GetEntryTypeRequest.newBuilder()
              .setName(EntryTypeName.of("[PROJECT]", "[LOCATION]", "[ENTRY_TYPE]").toString())
              .build();
      EntryType response = catalogServiceClient.getEntryType(request);
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_get_entry_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.GetEntryTypeRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_entry_type(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the get_entry_type call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#get_entry_type.
#
def get_entry_type
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::GetEntryTypeRequest.new

  # Call the get_entry_type method.
  result = client.get_entry_type request

  # The returned object is of type Google::Cloud::Dataplex::V1::EntryType.
  p result
end

REST

如要擷取項目類型的詳細資料,請使用 entryTypes.get 方法。

更新項目類型

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「Catalog」(目錄) 頁面

  2. 按一下「項目類型」>「自訂」分頁標籤。

  3. 按一下要更新的項目類型。

  4. 在「項目類型詳細資料」頁面中,按一下「編輯」

  5. 視需要編輯顯示名稱、說明、系統、平台、型別別名和標籤。

  6. 按一下 [儲存]

gcloud

如要更新項目類型,請使用 gcloud dataplex entry-types update 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntryType</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void UpdateEntryTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryTypeRequest request = new UpdateEntryTypeRequest
        {
            EntryType = new EntryType(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<EntryType, OperationMetadata> response = catalogServiceClient.UpdateEntryType(request);

        // Poll until the returned long-running operation is complete
        Operation<EntryType, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        EntryType result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<EntryType, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceUpdateEntryType(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            EntryType retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.UpdateEntryTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryTypeRequest.
	}
	op, err := c.UpdateEntryType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryType;
import com.google.cloud.dataplex.v1.UpdateEntryTypeRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateEntryType {

  public static void main(String[] args) throws Exception {
    syncUpdateEntryType();
  }

  public static void syncUpdateEntryType() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      UpdateEntryTypeRequest request =
          UpdateEntryTypeRequest.newBuilder()
              .setEntryType(EntryType.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      EntryType response = catalogServiceClient.updateEntryTypeAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_update_entry_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.UpdateEntryTypeRequest()

    # Make the request
    operation = client.update_entry_type(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_entry_type call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#update_entry_type.
#
def update_entry_type
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::UpdateEntryTypeRequest.new

  # Call the update_entry_type method.
  result = client.update_entry_type request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要更新項目類型,請使用 entryTypes.patch 方法。

刪除項目類型

控制台

  1. 在 Google Cloud 控制台,前往 Dataplex Universal Catalog 的「Catalog」(目錄) 頁面。

    前往「目錄」

  2. 按一下「項目類型」>「自訂」分頁標籤。

  3. 按一下要刪除的項目類型。

  4. 在「項目類型詳細資料」頁面中,按一下「刪除」。當系統提示時,確認刪除。

gcloud

如要刪除項目類型,請使用 gcloud dataplex entry-types delete 指令

C#

C#

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 C# 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog C# API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for DeleteEntryType</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void DeleteEntryTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        DeleteEntryTypeRequest request = new DeleteEntryTypeRequest
        {
            EntryTypeName = EntryTypeName.FromProjectLocationEntryType("[PROJECT]", "[LOCATION]", "[ENTRY_TYPE]"),
            Etag = "",
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = catalogServiceClient.DeleteEntryType(request);

        // Poll until the returned long-running operation is complete
        Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Empty result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Empty, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceDeleteEntryType(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Empty retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Go 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Go API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.DeleteEntryTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteEntryTypeRequest.
	}
	op, err := c.DeleteEntryType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

Java

Java

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Java 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Java API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.DeleteEntryTypeRequest;
import com.google.cloud.dataplex.v1.EntryTypeName;
import com.google.protobuf.Empty;

public class SyncDeleteEntryType {

  public static void main(String[] args) throws Exception {
    syncDeleteEntryType();
  }

  public static void syncDeleteEntryType() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      DeleteEntryTypeRequest request =
          DeleteEntryTypeRequest.newBuilder()
              .setName(EntryTypeName.of("[PROJECT]", "[LOCATION]", "[ENTRY_TYPE]").toString())
              .setEtag("etag3123477")
              .build();
      catalogServiceClient.deleteEntryTypeAsync(request).get();
    }
  }
}

Python

Python

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Python 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Python API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_delete_entry_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.DeleteEntryTypeRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_entry_type(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

在試用這個範例之前,請先按照「使用用戶端程式庫的 Dataplex Universal Catalog 快速入門導覽課程」中的 Ruby 設定操作說明進行操作。詳情請參閱 Dataplex Universal Catalog Ruby API 參考文件

如要向 Dataplex Universal Catalog 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

require "google/cloud/dataplex/v1"

##
# Snippet for the delete_entry_type call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#delete_entry_type.
#
def delete_entry_type
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::DeleteEntryTypeRequest.new

  # Call the delete_entry_type method.
  result = client.delete_entry_type request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

如要刪除項目類型,請使用 entryTypes.delete 方法。

後續步驟