アスペクトを管理してメタデータを拡充する

Knowledge Catalog(旧称 Dataplex Universal Catalog)のアスペクトとアスペクト タイプを使用すると、エントリ、列、エントリリンクに構造化メタデータを追加して、データアセットとその関係を記述できます。このコンテキストにより、データの検出可能性が向上し、個人情報(PII)などの機密情報を分類して、データ品質ポリシーやアクセス ポリシーを適用できます。

アスペクト スキーマ、システム アスペクト タイプとカスタム アスペクト タイプ、ターゲット レベル、データ所在地の制約に関するコンセプトについては、アスペクトとアスペクト タイプについてをご覧ください。メタデータ メタモデル全体のアーキテクチャの概要については、Knowledge Catalog のメタデータについてをご覧ください。Knowledge Catalog メタデータを初めて使用する場合は、BigQuery テーブルにメタデータを追加するまたはビジネス用語集を作成して使用するのクイックスタートをご覧ください。

始める前に

アスペクト タイプとアスペクトを作成し、管理する前に、このセクションで説明するタスクを完了してください。

必要なロール

アスペクト タイプとアスペクトを作成して管理するために必要な権限を取得するには、プロジェクトに対する次の IAM ロールの付与を管理者に依頼してください。これらのロールをすべて同時に必要とするわけではありません。特定のワークフローに一致するロールまたは組み合わせを選択してください。

アスペクト タイプとアスペクトを作成して管理するために必要な権限を取得するには、プロジェクトに対する次の IAM ロールの付与を管理者に依頼してください。

  • アスペクト タイプやエントリなど、すべてのカタログ リソースを広範な管理者アクセス権で管理する: Dataplex Catalog 管理者(roles/dataplex.catalogAdmin)または Dataplex Catalog 編集者(roles/dataplex.catalogEditor)
  • アスペクト タイプ管理者に対する最小権限アクセスでカスタム アスペクト タイプのみを作成、管理する: Dataplex アスペクト タイプ オーナー(roles/dataplex.aspectTypeOwner)
  • データ キュレーターに最小権限アクセスを付与して、エントリの作成または変更時にアスペクト タイプを使用する: Dataplex アスペクト タイプ ユーザー(roles/dataplex.aspectTypeUser)
  • schema、contacts、overview などの再利用可能なシステム アスペクト タイプをエントリとエントリリンクにアタッチする: Dataplex エントリと EntryLink オーナー(roles/dataplex.entryOwner)
  • アスペクト タイプとその IAM ポリシーを変更せずに表示する: Dataplex Catalog 閲覧者(roles/dataplex.catalogViewer)

ロールの付与については、プロジェクト、フォルダ、組織へのアクセス権の管理をご覧ください。

これらの事前定義ロールには、アスペクト タイプとアスペクトの作成と管理に必要な権限が含まれています。必要とされる正確な権限については、「必要な権限」セクションを開いてご確認ください。

必要な権限

アスペクト タイプとアスペクトを作成して管理するには、次の権限が必要です。

  • アスペクト タイプの作成、表示、一覧表示、更新、削除:
    • dataplex.aspectTypes.create
    • dataplex.aspectTypes.get
    • dataplex.aspectTypes.list
    • dataplex.aspectTypes.update
    • dataplex.aspectTypes.delete
  • アスペクト タイプを使用してエントリを拡充する: dataplex.aspectTypes.use
  • エントリとそのアスペクトを作成、表示、更新、削除する:
    • dataplex.entries.create
    • dataplex.entries.get
    • dataplex.entries.list
    • dataplex.entries.update
    • dataplex.entries.delete
  • エントリリンクとそのアスペクトを作成、表示、更新、削除する:
    • dataplex.entryLinks.create
    • dataplex.entryLinks.get
    • dataplex.entryLinks.list
    • dataplex.entryLinks.update
    • dataplex.entryLinks.delete

カスタムロールや他の事前定義ロールを使用して、これらの権限を取得することもできます。

詳細については、Knowledge Catalog の IAM ロールをご覧ください。

API を有効にする

Knowledge Catalog プロジェクトで Dataplex API を有効にします。新しい Google Cloud プロジェクトまたは BigQuery API が有効になっているプロジェクトを使用している場合、Dataplex API はデフォルトで有効になっています。

API を有効にする

カスタムのアスペクト タイプを作成する

コンソール

Google Cloud コンソールでカスタム アスペクト タイプを作成するには、次のサブタスクを行います。

  1. 基本情報を構成する:

    1. Google Cloud コンソールで、Knowledge Catalog の [メタデータのタイプ] ページに移動します。

      [メタデータのタイプ] に移動

    2. [アスペクトの種類] > [カスタム] タブをクリックし、[アスペクトの種類を作成] をクリックします。

    3. [詳細] セクションに、次のように入力します。

      • 省略可: 表示名: アスペクト タイプのユーザー フレンドリーな名前。
      • アスペクト タイプ ID: アスペクト タイプの固有識別子。
      • 省略可: 説明: アスペクト タイプとその目的の説明。
      • ロケーション: アスペクト タイプのロケーションを選択します。作成後にロケーションを変更することはできません。グローバル ロケーションとリージョン ロケーションのトレードオフについては、カスタムのアスペクト タイプをご覧ください。
  2. スキーマ テンプレートを定義する:

    テンプレートは、アスペクト タイプ内でグループ化されたメタデータ フィールドの形式とスキーマを定義します。フィールドを手動で定義することも、テンプレート ギャラリーからスターター テンプレート(データ機密性、データ ガバナンス、データの取り込みなど)を選択してスキーマの作成を高速化することもできます。たとえば、[Data Sensitivity] テンプレートを選択すると、ブール値フィールド Is Encrypted と Has PII、列挙型フィールド PII Type が自動的に追加されます。

    フィールドを手動で定義するには:

    1. [テンプレート] セクションで、[フィールドを追加] をクリックします。
    2. [新しいフィールド] パネルで、次のように指定します。
      • 名前: フィールドの識別子。
      • 省略可: 表示名: ユーザー フレンドリーなラベル。
      • オプション: 説明: フィールドの簡単な説明。
      • 型: フィールドのデータ型を選択します。サポートされている型には、テキスト、整数、ブール値、日付と時刻、倍精度浮動小数点数、列挙型、配列、マップ、レコードがあります。
      • 省略可: 必須: ユーザーがこのアスペクトをアタッチするときにフィールドを必須にするには、このチェックボックスをオンにします。
    3. [完了] をクリックします。フィールドをさらに追加するには、[フィールドを追加] をクリックして、上記の手順を繰り返します。
  3. リソースラベルを追加して保存する:

    リソースラベルは、 Google Cloud リソースの整理とフィルタリングに役立つ任意の Key-Value ペアです。たとえば、environment: production や team: analytics などのラベルを使用して、環境またはチームの所有権別にリソースを整理できます。

    1. [ラベル] セクションで [ラベルを追加] をクリックします。
    2. ラベルのキーと値を入力します。
    3. [保存] をクリックします。

gcloud

カスタムのアスペクト タイプを作成するには、gcloud dataplex aspect-types create コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for CreateAspectType</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 CreateAspectTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        CreateAspectTypeRequest request = new CreateAspectTypeRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            AspectTypeId = "",
            AspectType = new AspectType(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<AspectType, OperationMetadata> response = catalogServiceClient.CreateAspectType(request);

        // Poll until the returned long-running operation is complete
        Operation<AspectType, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        AspectType 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<AspectType, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceCreateAspectType(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            AspectType retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.CreateAspectTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateAspectTypeRequest.
	}
	op, err := c.CreateAspectType(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

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.AspectType;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.CreateAspectTypeRequest;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateAspectType {

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

  public static void syncCreateAspectType() 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()) {
      CreateAspectTypeRequest request =
          CreateAspectTypeRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setAspectTypeId("aspectTypeId-423030675")
              .setAspectType(AspectType.newBuilder().build())
              .setValidateOnly(true)
              .build();
      AspectType response = catalogServiceClient.createAspectTypeAsync(request).get();
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The resource name of the AspectType, of the form:
 *  projects/{project_number}/locations/{location_id}
 *  where `location_id` refers to a Google Cloud region.
 */
// const parent = 'abc123'
/**
 *  Required. AspectType identifier.
 */
// const aspectTypeId = 'abc123'
/**
 *  Required. AspectType Resource.
 */
// const aspectType = {}
/**
 *  Optional. The service validates the request without performing any
 *  mutations. The default is false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callCreateAspectType() {
  // Construct request
  const request = {
    parent,
    aspectTypeId,
    aspectType,
  };

  // Run request
  const [operation] = await dataplexClient.createAspectType(request);
  const [response] = await operation.promise();
  console.log(response);
}

callCreateAspectType();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_aspect_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    aspect_type = dataplex_v1.AspectType()
    aspect_type.metadata_template.name = "name_value"
    aspect_type.metadata_template.type_ = "type__value"

    request = dataplex_v1.CreateAspectTypeRequest(
        parent="parent_value",
        aspect_type_id="aspect_type_id_value",
        aspect_type=aspect_type,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the create_aspect_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_aspect_type.
#
def create_aspect_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::CreateAspectTypeRequest.new

  # Call the create_aspect_type method.
  result = client.create_aspect_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

カスタムのアスペクト タイプを作成するには、aspectType.create メソッドを使用します。

カスタムのアスペクト タイプを作成したら、エントリにアスペクトを追加できます。

レコード ID フィールドとレコード参照フィールドの使用例

再帰参照には、[レコード ID] フィールドと [レコード参照] フィールドを使用できます。次の例では、これらのフィールドの使用方法を示します。

次のフィールドを持つ Employee というアスペクト タイプについて考えてみましょう。

  • 名前(タイプ: Text)
  • 開始日(タイプ: Date & time)
  • 申告(タイプ: Text)
  • 現在のアドレス(タイプ: Record)
  • 永続的なアドレス(タイプ: Record)

2 つのアドレス フィールド([現在のアドレス] と [永続的なアドレス])は同じデータタイプ Record です。重複を回避するには、これらのフィールドを定義するときに [レコード ID] と [レコード参照] の値を設定します。

[現在のアドレス] フィールドを定義するときに、レコード ID を address-field として指定できます。[永続的なアドレス] には、[レコード参照] と同じ値(address-field)を指定できます。次に例を示します。

  • 名前(タイプ: Text)
  • 開始日(タイプ: Date & time)
  • 申告(タイプ: Text)
  • 現在のアドレス(タイプ: Record、レコード ID: address-field)
  • 永続的なアドレス(タイプ: Record、レコード参照: address-field)

これにより、別の住所のフィールドを複製する必要がなくなります。

エントリにアスペクトを追加する

カスタム アスペクト タイプを作成したら、そのタイプのアスペクトを作成できます。アスペクトはエントリ内に保存されるため、エントリにアスペクトを追加するには、エントリを更新する必要があります。

次の制限事項があります。

  • アスペクトはエントリまたはエントリの列に追加できます。
  • 必須アスペクトを編集できるのは、カスタム エントリの場合のみです。必須アスペクトは削除できません。
  • カスタム エントリとシステム エントリの両方で、オプションのアスペクトを編集および削除できます。
  • CREATE OR REPLACE TABLE ステートメント、TRUNCATE TABLE ステートメント、または WRITE_TRUNCATE ジョブを使用して BigQuery テーブルを置換または再読み込みすると、Knowledge Catalog はエントリのユーザーがアタッチしたアスペクトを保持します。列レベルのアスペクトは、スキーマに残っている列にも保持されます。ただし、DROP TABLE ステートメントと CREATE TABLE ステートメントを使用してテーブルを削除して再作成すると、Knowledge Catalog は、元のテーブルのユーザーがアタッチしたアスペクトなしで新しいエントリを作成します。テーブルを再読み込みするときにアスペクトを保持するには、CREATE OR REPLACE TABLE、TRUNCATE TABLE、WRITE_TRUNCATE を使用します。または、BigQuery ビューを作成して、ビューにアスペクトをアタッチすることもできます。

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [検索] ページに移動します。

    [検索] に移動

  2. アスペクトを追加するエントリを検索し、そのエントリをクリックします。[エントリの詳細] ページが開きます。

  3. [エントリの詳細] ページで、[詳細] タブをクリックします。

  4. [アスペクト] セクションで、[必須アスペクト] または [オプションのアスペクト] 領域の [追加] をクリックします。必須アスペクトを追加できるのは、エントリタイプで必須アスペクトが定義されている場合のみです。

  5. 追加するアスペクトを検索して選択します。

  6. [アスペクトを追加] ウィンドウで、フィールドの値を入力します。

  7. [保存] をクリックします。

エントリの列にアスペクトを追加するには:

  1. [エントリの詳細] ページで [スキーマ] タブをクリックします。
  2. アスペクトを追加する列を選択します。
  3. [アスペクトを追加] をクリックします。
  4. 追加するアスペクトを検索して選択します。
  5. [アスペクトを追加] ウィンドウで、フィールドの値を入力します。
  6. [保存] をクリックします。

gcloud

エントリまたはエントリの列にアスペクトを追加するには、gcloud dataplex entries update コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntry</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 UpdateEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryRequest request = new UpdateEntryRequest
        {
            Entry = new Entry(),
            UpdateMask = new FieldMask(),
            AllowMissing = false,
            DeleteMissingAspects = false,
            AspectKeys = { "", },
        };
        // Make the request
        Entry response = catalogServiceClient.UpdateEntry(request);
    }
}

エントリ オブジェクトにアスペクトを追加するには、アスペクトをご覧ください。

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.UpdateEntryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryRequest.
	}
	resp, err := c.UpdateEntry(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

エントリ オブジェクトにアスペクトを追加するには、エントリをご覧ください。

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.Aspect;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.EntryName;
import com.google.cloud.dataplex.v1.EntrySource;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import java.util.Map;

public class UpdateEntry {

  public static void main(String[] args) throws Exception {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "MY_PROJECT_ID";
    // Available locations: https://cloud.google.com/dataplex/docs/locations
    String location = "MY_LOCATION";
    String entryGroupId = "MY_ENTRY_GROUP_ID";
    String entryId = "MY_ENTRY_ID";

    Entry createdEntry = updateEntry(projectId, location, entryGroupId, entryId);
    System.out.println("Successfully updated entry: " + createdEntry.getName());
  }

  // Method to update Entry located in projectId, location, entryGroupId and with entryId
  public static Entry updateEntry(
      String projectId, String location, String entryGroupId, String entryId) throws Exception {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests.
    try (CatalogServiceClient client = CatalogServiceClient.create()) {
      Entry entry =
          Entry.newBuilder()
              .setName(EntryName.of(projectId, location, entryGroupId, entryId).toString())
              .setEntrySource(
                  EntrySource.newBuilder()
                      .setDescription("updated description of the entry")
                      .build())
              .putAllAspects(
                  Map.of(
                      "dataplex-types.global.generic",
                      Aspect.newBuilder()
                          .setAspectType(
                              "projects/dataplex-types/locations/global/aspectTypes/generic")
                          .setData(
                              Struct.newBuilder()
                                  // "Generic" Aspect Type have fields called "type" and "system.
                                  // The values below are a sample of possible options.
                                  .putFields(
                                      "type",
                                      Value.newBuilder()
                                          .setStringValue("updated example value")
                                          .build())
                                  .putFields(
                                      "system",
                                      Value.newBuilder()
                                          .setStringValue("updated example system")
                                          .build())
                                  .build())
                          .build()))
              .build();

      // Update mask specifies which fields will be updated.
      // For more information on update masks, see: https://google.aip.dev/161
      FieldMask updateMask =
          FieldMask.newBuilder().addPaths("aspects").addPaths("entry_source.description").build();
      return client.updateEntry(entry, updateMask);
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Entry resource.
 */
// const entry = {}
/**
 *  Optional. Mask of fields to update. To update Aspects, the update_mask must
 *  contain the value "aspects".
 *  If the update_mask is empty, the service will update all modifiable fields
 *  present in the request.
 */
// const updateMask = {}
/**
 *  Optional. If set to true and the entry doesn't exist, the service will
 *  create it.
 */
// const allowMissing = true
/**
 *  Optional. If set to true and the aspect_keys specify aspect ranges, the
 *  service deletes any existing aspects from that range that weren't provided
 *  in the request.
 */
// const deleteMissingAspects = true
/**
 *  Optional. The map keys of the Aspects which the service should modify. It
 *  supports the following syntaxes:
 *  * `<aspect_type_reference>` - matches an aspect of the given type and empty
 *  path.
 *  * `<aspect_type_reference>@path` - matches an aspect of the given type and
 *  specified path. For example, to attach an aspect to a field that is
 *  specified by the `schema` aspect, the path should have the format
 *  `Schema.<field_name>`.
 *  * `<aspect_type_reference>@*` - matches aspects of the given type for all
 *  paths.
 *  * `*@path` - matches aspects of all types on the given path.
 *  The service will not remove existing aspects matching the syntax unless
 *  `delete_missing_aspects` is set to true.
 *  If this field is left empty, the service treats it as specifying
 *  exactly those Aspects present in the request.
 */
// const aspectKeys = ['abc','def']

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callUpdateEntry() {
  // Construct request
  const request = {
    entry,
  };

  // Run request
  const response = await dataplexClient.updateEntry(request);
  console.log(response);
}

callUpdateEntry();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

from google.cloud import dataplex_v1
from google.protobuf import struct_pb2


def update_entry(
    project_id: str, location: str, entry_group_id: str, entry_id: str
) -> dataplex_v1.Entry:
    """Method to update Entry located in project_id, location, entry_group_id and with entry_id"""

    # Initialize client that will be used to send requests across threads. This
    # client only needs to be created once, and can be reused for multiple requests.
    # After completing all of your requests, call the "__exit__()" method to safely
    # clean up any remaining background resources. Alternatively, use the client as
    # a context manager.
    with dataplex_v1.CatalogServiceClient() as client:
        # The resource name of the Entry
        name = f"projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}"
        entry = dataplex_v1.Entry(
            name=name,
            entry_source=dataplex_v1.EntrySource(
                description="updated description of the entry"
            ),
            aspects={
                "dataplex-types.global.generic": dataplex_v1.Aspect(
                    aspect_type="projects/dataplex-types/locations/global/aspectTypes/generic",
                    data=struct_pb2.Struct(
                        fields={
                            # "Generic" Aspect Type have fields called "type" and "system.
                            # The values below are a sample of possible options.
                            "type": struct_pb2.Value(
                                string_value="updated example value"
                            ),
                            "system": struct_pb2.Value(
                                string_value="updated example system"
                            ),
                        }
                    ),
                )
            },
        )

        # Update mask specifies which fields will be updated.
        # For more information on update masks, see: https://google.aip.dev/161
        update_mask = {"paths": ["aspects", "entry_source.description"]}
        return client.update_entry(entry=entry, update_mask=update_mask)


if __name__ == "__main__":
    # TODO(developer): Replace these variables before running the sample.
    project_id = "MY_PROJECT_ID"
    # Available locations: https://cloud.google.com/dataplex/docs/locations
    location = "MY_LOCATION"
    entry_group_id = "MY_ENTRY_GROUP_ID"
    entry_id = "MY_ENTRY_ID"

    updated_entry = update_entry(project_id, location, entry_group_id, entry_id)
    print(f"Successfully updated entry: {updated_entry.name}")

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_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#update_entry.
#
def update_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::UpdateEntryRequest.new

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

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

エントリ オブジェクトにアスペクトを追加するには、#required_aspects= をご覧ください。

REST

エントリまたはエントリの列にアスペクトを追加するには、entry.patch メソッドを使用します。

それぞれのアスペクト タイプとエントリが異なる Google Cloud 組織にあるエントリでアスペクトを作成して使用することはできません。

再利用可能なシステム アスペクト タイプのアスペクトを適用する

Knowledge Catalog には、エントリにアタッチして標準化されたメタデータをキャプチャできる、事前定義されたシステム アスペクト タイプが用意されています。たとえば、これらのアスペクト タイプを使用して、オーナーの連絡先、スキーマ定義、使用状況の指標、データ品質の結果を記録できます。

一般的なワークフローとペイロード ルール

再利用可能なシステム アスペクト タイプのアスペクトをアタッチする場合は、次のルールに従います。

  • コンソールと CLI / REST: generic などのネストされたフィールドのないアスペクト タイプの場合は、 Google Cloud コンソール、gcloud CLI、または REST API を使用できます。data-quality-scorecard、contacts、data-profile などの複雑な構造やネストされた構造を持つアスペクト タイプの場合は、gcloud CLI または REST API を使用する必要があります。
  • ペイロード構造:
    • gcloud CLI: グローバル アスペクト タイプ識別子 {"dataplex-types.global.<ASPECT_TYPE>": {"data": { ... }}} をキーとして、アスペクト マップを直接渡します。
    • REST API: アスペクト マップを "aspects" コンテナ オブジェクト({"aspects": {"dataplex-types.global.<ASPECT_TYPE>": {"data": { ... }}}})内にラップします。
  • 上書き動作: アスペクトを更新すると、ターゲット エントリまたは列の特定のアスペクト タイプの既存のデータが置き換えられます。フィールドはマージされません。

以降のセクションでは、データ品質スコアカードをはじめとする、再利用可能な一般的なシステム アスペクトをアタッチするための例とスキーマを示します。

データ品質スコアカード

データ品質スコアカードは、データ品質スキャンやその他のプロセスに基づいて、データ品質の概要を提供するアスペクトです。データ品質スコアカードをエントリにアタッチして、カスタムのデータ品質情報を提供できます。これを行うには、システム定義タイプ data-quality-scorecard のアスペクトをアタッチします。

data-quality-scorecard アスペクト内の data フィールドには、次のフィールドを含めることができます。

  • job: 省略可。スコアカードを生成したジョブの詳細を含むレコード。

    • name: データ品質ジョブのリソース名。

    • runTime: データ品質ジョブの実行時間。

  • score: 省略可。全体的なデータ品質スコア。スコアの範囲は [0, 100] です。

  • status: 必須。データ品質スコアカードのステータス。品質しきい値に合格したか不合格だったかを示します(PASS または FAIL)。

  • dimensions: 省略可。ディメンション結果の配列。各結果には次のものが含まれます。

    • name: ディメンションの名前。ACCURACY、COMPLETENESS、CONSISTENCY、FRESHNESS、UNIQUENESS、VALIDITY、VOLUME、またはカスタム ディメンション名のいずれかです。カスタム ディメンション名には大文字を使用し、30 文字以下にする必要があります。

    • score: ディメンション レベルの全体的なスコア([0, 100] の範囲)。

    • status: ディメンションのステータス。品質しきい値に合格したか不合格だったかを示します(PASS または FAIL)。

  • columns: 省略可。列の結果の配列。各結果には次のものが含まれます。

    • name: 列の名前。

    • score: 列レベルの全体的なスコア([0, 100] の範囲)。

    • status: 列のステータス。品質しきい値に合格したか不合格だったかを示します(PASS または FAIL)。

    • dimensions: 列のディメンション スコアの配列。各ディメンション スコアには次のものが含まれます。

      • name: ディメンションの名前。

      • score: ディメンションのスコア([0, 100] の範囲)。

      • status: 列のディメンションのステータス。品質しきい値に合格したか不合格だったかを示します(PASS、FAIL、UNKNOWN、NOT_APPLICABLE)。

    • details(省略可能なマップ): 評価に関する追加のコンテキストを提供する Key-Value ペア。

    • evaluatedAssetCount(省略可能な整数): 評価されたアセットの数。

アスペクトをアタッチするコマンドを実行すると、その特定のアスペクトの既存のデータが置き換えられます。たとえば、スコアが 80 のスコアカードを、スコアが 90 の新しいファイルで更新すると、80 は上書きされます。データは結合されません。

データ品質スコアカードを添付する手順は次のとおりです。

gcloud

エントリのアスペクトを更新するには、gcloud dataplex entries update-aspects コマンドを使用します。

  1. 次の内容を含む JSON ファイル(dq-aspect.json)を作成します。

    {
      "dataplex-types.global.data-quality-scorecard": {
        "data": {
          "score": 80,
          "status": "PASS",
          "dimensions": [
            {
              "name": "completeness",
              "score": 90,
              "status": "PASS"
            },
            {
              "name": "uniqueness",
              "score": 70,
              "status": "FAIL"
            }
          ],
          "columns": [
            {
              "name": "col1",
              "score": 85,
              "status": "PASS"
            }
          ]
        }
      }
    }
    
  2. 次のコマンドを実行します。

      gcloud dataplex entries update-aspects ENTRY_ID \
      --location=LOCATION \
      --entry-group=ENTRY_GROUP_ID \
      --project=PROJECT_ID \
      --aspects=dq-aspect.json
    

    次の変数を置き換えます。

    • ENTRY_ID: エントリの ID(例: example-entry)。
    • LOCATION: エントリのロケーション(例: us-central1)
    • ENTRY_GROUP_ID: エントリ グループの ID(例: example-entry-group)
    • PROJECT_ID: プロジェクトの ID(例: example-project)。

REST

エントリのアスペクトを更新するには、entry.patch メソッドを使用します。

  1. payload.json という名前のファイルを作成し、リクエストの JSON コンテンツを貼り付けます。

    
      {
        "aspects": {
          "dataplex-types.global.data-quality-scorecard": {
            "data": {
              "score": 80,
              "status": "PASS",
              "dimensions": [
                {
                  "name": "completeness",
                  "score": 90,
                  "status": "PASS"
                },
                {
                  "name": "uniqueness",
                  "score": 70,
                  "status": "FAIL"
                }
              ],
              "columns": [
                {
                  "name": "col1",
                  "score": 85,
                  "status": "PASS"
                }
              ]
            }
          }
        }
      }
    
  2. ターミナルで次のコマンドを実行します。

     curl -X PATCH \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json" \
     -d @payload.json \
     "https://dataplex.googleapis.com/v1/projects/<var>PROJECT_ID</var>/locations/<var>LOCATION</var>/entryGroups/<var>ENTRY_GROUP_ID</var>/entries/<var>ENTRY_ID</var>?updateMask=aspects"
    

    次のように置き換えます。

    • PROJECT_ID: プロジェクトの ID(例: example-project)
    • LOCATION: エントリのロケーション(例: us-central1)
    • ENTRY_GROUP_ID: エントリ グループの ID(例: example-entry-group)
    • ENTRY_ID: エントリの ID(例: example-entry)

その他の再利用可能なアスペクト タイプ

エントリの拡充には、次のシステム アスペクト タイプも使用できます。フロントローディングされた概要は、次のセクションに記載されています。展開可能な各セクションをクリックすると、フィールド スキーマと JSON ペイロードの例が表示されます。

連絡先(dataplex-types.global.contacts)

contacts アスペクト タイプを使用して、エントリにオーナー、スチュワード、オペレーションのロールを割り当てます。

  • identities(配列): 連絡先のリスト。各連絡先には、role(owner、steward、producer、admin など)、name、id(メールアドレス)が含まれます。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.contacts": {
      "data": {
        "identities": [
          {
            "role": "steward",
            "name": "Jane Doe",
            "id": "jane.doe@example.com"
          }
        ]
      }
    }
  }
}
    

データ プロファイル(dataplex-types.global.data-profile)

data-profile アスペクト タイプを使用して、ソースデータ スキャンから生成された統計プロファイリング結果をキャプチャします。詳細については、データのプロファイリングについてをご覧ください。

  • sourceDataInfo(レコード): スキャンに関するメタデータ。scope(PREVIEW、SAMPLED、ALL)、scannedRows、samplingPercentage など。
  • fields(マップ): 列レベルの統計情報。nullness、uniqueness、数値、文字列、日時、配列の列のタイプ固有の指標が含まれます。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.data-profile": {
      "data": {
        "sourceDataInfo": {
          "scope": "ALL",
          "scannedRows": 100
        },
        "fields": {
          "col1": {
            "nullness": 0.0,
            "uniqueness": 0.1,
            "string": {
              "length": {
                "min": 1,
                "max": 20,
                "avg": 12.54
              }
            }
          }
        }
      }
    }
  }
}
    

汎用(dataplex-types.global.generic)

generic アスペクト タイプを使用すると、カスタム アスペクト スキーマを定義せずに、自由形式のエントリ情報とソースシステムのメタデータをキャプチャできます。

  • type(文字列): ユーザー指定のエントリ分類文字列。
  • system(文字列): カスタム エントリのソースシステム識別子。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.generic": {
      "data": {
        "type": "custom-type",
        "system": "custom-system"
      }
    }
  }
}
    

概要(dataplex-types.global.overview)

overview アスペクト タイプを使用して、人が読める形式のリッチテキスト ドキュメントと、役立つ外部リンクを提供します。

  • content(文字列): HTML 形式をサポートするリッチテキストの説明。
  • links(配列): 外部リソースとドキュメント リンク。それぞれに url と title が含まれます。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.overview": {
      "data": {
        "content": "This is a rich text description.",
        "links": [
          {
            "url": "https://example.com",
            "title": "Example Link"
          }
        ]
      }
    }
  }
}
    

スキーマ(dataplex-types.global.schema)

schema アスペクト タイプを使用して、データアセットの表形式スキーマ、列名、モード、データ型を記述します。

  • fields(配列): 列のリスト。各列には name、dataType、metadataType(STRING、BOOLEAN など)、mode(NULLABLE、REQUIRED、REPEATED)、オプションの description が含まれます。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.schema": {
      "data": {
        "fields": [
          {
            "name": "id",
            "dataType": "string",
            "metadataType": "STRING",
            "mode": "REQUIRED"
          }
        ]
      }
    }
  }
}
    

使用量(dataplex-types.global.usage)

usage アスペクト タイプを使用して、消費指標、視聴回数、時系列クエリパターンを追跡します。

  • metrics(配列): 消費指標。各指標には、name(views や reads など)と、集計間隔と値を含む timeSeries データポイントが含まれます。
  • refreshTime(日時): 使用状況の指標が最後に計算されたときのタイムスタンプ。

ペイロードの例(REST API):

{
  "aspects": {
    "dataplex-types.global.usage": {
      "data": {
        "metrics": [
          {
            "name": "views",
            "timeSeries": [
              {
                "interval": "30d",
                "value": 100
              }
            ]
          }
        ],
        "refreshTime": "2025-01-01T12:00:00Z"
      }
    }
  }
}
    

エントリリンクを作成する

エントリリンクを作成することで、2 つのエントリ間の関係を確立できます。

エントリリンクは、synonym などの対称リンク、または definition などの非対称リンクにできます。

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for CreateEntryLink</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 CreateEntryLinkRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        CreateEntryLinkRequest request = new CreateEntryLinkRequest
        {
            ParentAsEntryGroupName = EntryGroupName.FromProjectLocationEntryGroup("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"),
            EntryLinkId = "",
            EntryLink = new EntryLink(),
        };
        // Make the request
        EntryLink response = catalogServiceClient.CreateEntryLink(request);
    }
}

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.CreateEntryLinkRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateEntryLinkRequest.
	}
	resp, err := c.CreateEntryLink(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.CreateEntryLinkRequest;
import com.google.cloud.dataplex.v1.EntryGroupName;
import com.google.cloud.dataplex.v1.EntryLink;

public class SyncCreateEntryLink {

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

  public static void syncCreateEntryLink() 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()) {
      CreateEntryLinkRequest request =
          CreateEntryLinkRequest.newBuilder()
              .setParent(EntryGroupName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]").toString())
              .setEntryLinkId("entryLinkId-1349584441")
              .setEntryLink(EntryLink.newBuilder().build())
              .build();
      EntryLink response = catalogServiceClient.createEntryLink(request);
    }
  }
}

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The resource name of the parent Entry Group:
 *  `projects/{project_id_or_number}/locations/{location_id}/entryGroups/{entry_group_id}`.
 */
// const parent = 'abc123'
/**
 *  Required. Entry Link identifier
 *  * Must contain only lowercase letters, numbers and hyphens.
 *  * Must start with a letter.
 *  * Must be between 1-63 characters.
 *  * Must end with a number or a letter.
 *  * Must be unique within the EntryGroup.
 */
// const entryLinkId = 'abc123'
/**
 *  Required. Entry Link resource.
 */
// const entryLink = {}

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callCreateEntryLink() {
  // Construct request
  const request = {
    parent,
    entryLinkId,
    entryLink,
  };

  // Run request
  const response = await dataplexClient.createEntryLink(request);
  console.log(response);
}

callCreateEntryLink();

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_link():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    entry_link = dataplex_v1.EntryLink()
    entry_link.entry_link_type = "entry_link_type_value"
    entry_link.entry_references.name = "name_value"
    entry_link.entry_references.type_ = "TARGET"

    request = dataplex_v1.CreateEntryLinkRequest(
        parent="parent_value",
        entry_link_id="entry_link_id_value",
        entry_link=entry_link,
    )

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

    # Handle the response
    print(response)

REST

必要なアスペクトを含むエントリリンクを作成するには、リクエスト本文にアスペクト データを含めて entryLinks.create メソッドを使用します。

エントリリンクにアスペクトを追加する

エントリ間の関係に関する情報でメタデータを拡充するには、エントリリンクにアスペクトを追加します。

特定のアスペクトを必須にするようにエントリリンク タイプを構成できます。このようなタイプのエントリリンクを作成する場合は、必須のアスペクトを指定する必要があります。

これらのアスペクトは、エントリリンクの作成時に追加することも、既存のエントリリンクを更新して追加することもできます。

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntryLink</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 UpdateEntryLinkRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryLinkRequest request = new UpdateEntryLinkRequest
        {
            EntryLink = new EntryLink(),
            AllowMissing = false,
            AspectKeys = { "", },
        };
        // Make the request
        EntryLink response = catalogServiceClient.UpdateEntryLink(request);
    }
}

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.UpdateEntryLinkRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryLinkRequest.
	}
	resp, err := c.UpdateEntryLink(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.EntryLink;
import com.google.cloud.dataplex.v1.UpdateEntryLinkRequest;
import java.util.ArrayList;

public class SyncUpdateEntryLink {

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

  public static void syncUpdateEntryLink() 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()) {
      UpdateEntryLinkRequest request =
          UpdateEntryLinkRequest.newBuilder()
              .setEntryLink(EntryLink.newBuilder().build())
              .setAllowMissing(true)
              .addAllAspectKeys(new ArrayList<String>())
              .build();
      EntryLink response = catalogServiceClient.updateEntryLink(request);
    }
  }
}

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Entry Link resource.
 */
// const entryLink = {}
/**
 *  Optional. If set to true and the entry link doesn't exist, the service will
 *  create it.
 */
// const allowMissing = true
/**
 *  Optional. The map keys of the Aspects which the service should modify.
 *  It should be the aspect type reference in the format
 *  `{project_id_or_number}.{location_id}.{aspect_type_id}`.
 *  If this field is left empty, the service treats it as specifying
 *  exactly those Aspects present in the request.
 */
// const aspectKeys = ['abc','def']

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callUpdateEntryLink() {
  // Construct request
  const request = {
    entryLink,
  };

  // Run request
  const response = await dataplexClient.updateEntryLink(request);
  console.log(response);
}

callUpdateEntryLink();

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_link():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    entry_link = dataplex_v1.EntryLink()
    entry_link.entry_link_type = "entry_link_type_value"
    entry_link.entry_references.name = "name_value"
    entry_link.entry_references.type_ = "TARGET"

    request = dataplex_v1.UpdateEntryLinkRequest(
        entry_link=entry_link,
    )

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

    # Handle the response
    print(response)

REST

エントリリンクを更新するには、entryLinks.patch メソッドを使用します。このメソッドには、entryLink 本文のアスペクト データが含まれます。

エントリリンクでアスペクトを使用する場合の次の制限事項に注意してください。

  • オプションのアスペクトはサポートされていません。
  • データ アスペクトはサポートされていません。
  • カスタムタイプのアスペクトはサポートされていません。
  • 管理できるのは、システム アスペクト タイプ(schema-join など)で定義された必須アスペクトのみです。
  • アスペクトのコンテンツに基づいてエントリリンクを検索することはできません。
  • エントリリンク アスペクトのインポートまたはエクスポートはサポートされていません。

エントリの既存のアスペクトを管理する

このセクションでは、エントリの既存のアスペクトを更新および削除する方法について説明します。

アスペクトを更新する

オプションのアスペクトは、カスタム エントリとシステム エントリの両方で編集できます。必須アスペクトを編集できるのは、カスタム エントリの場合のみです。

BigQuery テーブルなどのファーストパーティ(1P)システム エントリの場合、modifyEntry API を使用してアスペクトを更新できます。これにより、ソースシステムのメタデータ更新権限(BigQuery データ編集者(roles/bigquery.dataEditor)など)を使用できます。

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [検索] ページに移動します。

    [検索] に移動

  2. アスペクトを更新するエントリを検索して、そのエントリをクリックします。

[エントリの詳細] ページが開きます。

  1. [詳細] タブをクリックします。
  2. [アスペクト] セクションで、更新するアスペクトを開き、[ 編集] をクリックします。
  3. [アスペクトの編集] ウィンドウで、必須フィールドを更新します。
  4. [保存] をクリックします。

gcloud

エントリまたはエントリの列のアスペクトを更新するには、gcloud dataplex entries update コマンドまたは gcloud dataplex entries update-aspects を使用します。

JSON ファイルを使用してアスペクトを更新するには:

gcloud dataplex entries update-aspects ENTRY_ID \
  --location=LOCATION \
  --entry-group=ENTRY_GROUP_ID \
  --project=PROJECT_ID \
  --aspects=ASPECTS_JSON_FILE

次のように置き換えます。

  • ENTRY_ID: エントリの ID。
  • LOCATION: エントリのロケーション。
  • ENTRY_GROUP_ID: エントリ グループの ID。
  • PROJECT_ID: プロジェクトの ID。
  • ASPECTS_JSON_FILE: アスペクト マップを含む JSON ファイルのパス。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntry</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 UpdateEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryRequest request = new UpdateEntryRequest
        {
            Entry = new Entry(),
            UpdateMask = new FieldMask(),
            AllowMissing = false,
            DeleteMissingAspects = false,
            AspectKeys = { "", },
        };
        // Make the request
        Entry response = catalogServiceClient.UpdateEntry(request);
    }
}

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.UpdateEntryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryRequest.
	}
	resp, err := c.UpdateEntry(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.UpdateEntryRequest;
import com.google.protobuf.FieldMask;
import java.util.ArrayList;

public class SyncUpdateEntry {

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

  public static void syncUpdateEntry() 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()) {
      UpdateEntryRequest request =
          UpdateEntryRequest.newBuilder()
              .setEntry(Entry.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setAllowMissing(true)
              .setDeleteMissingAspects(true)
              .addAllAspectKeys(new ArrayList<String>())
              .build();
      Entry response = catalogServiceClient.updateEntry(request);
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Entry resource.
 */
// const entry = {}
/**
 *  Optional. Mask of fields to update. To update Aspects, the update_mask must
 *  contain the value "aspects".
 *  If the update_mask is empty, the service will update all modifiable fields
 *  present in the request.
 */
// const updateMask = {}
/**
 *  Optional. If set to true and the entry doesn't exist, the service will
 *  create it.
 */
// const allowMissing = true
/**
 *  Optional. If set to true and the aspect_keys specify aspect ranges, the
 *  service deletes any existing aspects from that range that weren't provided
 *  in the request.
 */
// const deleteMissingAspects = true
/**
 *  Optional. The map keys of the Aspects which the service should modify. It
 *  supports the following syntaxes:
 *  * `<aspect_type_reference>` - matches an aspect of the given type and empty
 *  path.
 *  * `<aspect_type_reference>@path` - matches an aspect of the given type and
 *  specified path. For example, to attach an aspect to a field that is
 *  specified by the `schema` aspect, the path should have the format
 *  `Schema.<field_name>`.
 *  * `<aspect_type_reference>@*` - matches aspects of the given type for all
 *  paths.
 *  * `*@path` - matches aspects of all types on the given path.
 *  The service will not remove existing aspects matching the syntax unless
 *  `delete_missing_aspects` is set to true.
 *  If this field is left empty, the service treats it as specifying
 *  exactly those Aspects present in the request.
 */
// const aspectKeys = ['abc','def']

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callUpdateEntry() {
  // Construct request
  const request = {
    entry,
  };

  // Run request
  const response = await dataplexClient.updateEntry(request);
  console.log(response);
}

callUpdateEntry();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

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

    request = dataplex_v1.UpdateEntryRequest(
        entry=entry,
    )

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

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_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#update_entry.
#
def update_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::UpdateEntryRequest.new

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

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

REST

エントリまたはエントリの列のアスペクトを更新するには、entry.patch メソッドを使用します。

アスペクトを削除する

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [検索] ページに移動します。

    [検索] に移動

  2. 削除するアスペクトを含むエントリを検索して、そのエントリをクリックします。

[エントリの詳細] ページが開きます。

  1. [詳細] タブをクリックします。
  2. [アスペクト] セクションで、削除するアスペクトを開き、 [削除] をクリックします。
  3. [確認] をクリックします。

gcloud

エントリのアスペクトを削除するには、gcloud dataplex entries update コマンドを使用し、--remove-aspects フラグを指定します。

エントリレベルのアスペクトを削除するには:

gcloud dataplex entries update ENTRY_ID \
  --location=LOCATION \
  --entry-group=ENTRY_GROUP_ID \
  --project=PROJECT_ID \
  --remove-aspects='ASPECT_TYPE'

列レベルのアスペクトを削除するには:

gcloud dataplex entries update ENTRY_ID \
  --location=LOCATION \
  --entry-group=ENTRY_GROUP_ID \
  --project=PROJECT_ID \
  --remove-aspects='ASPECT_TYPE@Schema.COLUMN_NAME'

次のように置き換えます。

  • ENTRY_ID: エントリの ID。
  • LOCATION: エントリのロケーション。
  • ENTRY_GROUP_ID: エントリ グループの ID。
  • PROJECT_ID: プロジェクトの ID。
  • ASPECT_TYPE: 完全なアスペクト タイプ ID(例: dataplex-types.global.generic、<var>PROJECT_ID</var>.<var>LOCATION</var>.<var>ASPECT_TYPE_ID</var>)。
  • COLUMN_NAME: 列の名前。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateEntry</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 UpdateEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateEntryRequest request = new UpdateEntryRequest
        {
            Entry = new Entry(),
            UpdateMask = new FieldMask(),
            AllowMissing = false,
            DeleteMissingAspects = false,
            AspectKeys = { "", },
        };
        // Make the request
        Entry response = catalogServiceClient.UpdateEntry(request);
    }
}

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.UpdateEntryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateEntryRequest.
	}
	resp, err := c.UpdateEntry(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.UpdateEntryRequest;
import com.google.protobuf.FieldMask;
import java.util.ArrayList;

public class SyncUpdateEntry {

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

  public static void syncUpdateEntry() 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()) {
      UpdateEntryRequest request =
          UpdateEntryRequest.newBuilder()
              .setEntry(Entry.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setAllowMissing(true)
              .setDeleteMissingAspects(true)
              .addAllAspectKeys(new ArrayList<String>())
              .build();
      Entry response = catalogServiceClient.updateEntry(request);
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Entry resource.
 */
// const entry = {}
/**
 *  Optional. Mask of fields to update. To update Aspects, the update_mask must
 *  contain the value "aspects".
 *  If the update_mask is empty, the service will update all modifiable fields
 *  present in the request.
 */
// const updateMask = {}
/**
 *  Optional. If set to true and the entry doesn't exist, the service will
 *  create it.
 */
// const allowMissing = true
/**
 *  Optional. If set to true and the aspect_keys specify aspect ranges, the
 *  service deletes any existing aspects from that range that weren't provided
 *  in the request.
 */
// const deleteMissingAspects = true
/**
 *  Optional. The map keys of the Aspects which the service should modify. It
 *  supports the following syntaxes:
 *  * `<aspect_type_reference>` - matches an aspect of the given type and empty
 *  path.
 *  * `<aspect_type_reference>@path` - matches an aspect of the given type and
 *  specified path. For example, to attach an aspect to a field that is
 *  specified by the `schema` aspect, the path should have the format
 *  `Schema.<field_name>`.
 *  * `<aspect_type_reference>@*` - matches aspects of the given type for all
 *  paths.
 *  * `*@path` - matches aspects of all types on the given path.
 *  The service will not remove existing aspects matching the syntax unless
 *  `delete_missing_aspects` is set to true.
 *  If this field is left empty, the service treats it as specifying
 *  exactly those Aspects present in the request.
 */
// const aspectKeys = ['abc','def']

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callUpdateEntry() {
  // Construct request
  const request = {
    entry,
  };

  // Run request
  const response = await dataplexClient.updateEntry(request);
  console.log(response);
}

callUpdateEntry();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

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

    request = dataplex_v1.UpdateEntryRequest(
        entry=entry,
    )

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

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_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#update_entry.
#
def update_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::UpdateEntryRequest.new

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

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

REST

エントリのアスペクトを削除するには、entry.patch メソッドを使用します。

エントリリンクの既存のアスペクトを管理する

このセクションでは、エントリリンクの既存のアスペクトを更新する方法について説明します。

アスペクトを更新する

エントリリンクの場合、再利用可能なシステム アスペクト タイプを使用する必須アスペクトのみを更新できます。

詳細については、エントリリンク オペレーションの IAM 権限をご覧ください。

REST

必要なアスペクトでエントリリンクを更新するには、リクエスト本文にアスペクト データを含めて entryLinks.patch メソッドを使用します。

アスペクトを削除する

エントリリンクの必須アスペクトは削除できません。

アスペクト タイプを管理する

このセクションでは、アスペクト タイプを表示する方法と、カスタム アスペクト タイプを更新および削除する方法について説明します。

使用可能なアスペクト タイプのリストを表示する

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [メタデータのタイプ] ページに移動します。

    [メタデータのタイプ] に移動

  2. [アスペクト タイプ] タブをクリックします。

このページには、使用可能な Knowledge Catalog アスペクト タイプがすべて一覧表示されます。

  1. カスタム アスペクト タイプを表示するには、[カスタム] タブをクリックします。[カスタム] タブの [カタログソース] 列に、リソースが Knowledge Catalog のどこに存在するか表示されます。

システム アスペクト タイプを表示するには、[システム] タブをクリックします。

カスタム アスペクト タイプとシステム アスペクト タイプの詳細については、このドキュメントのアスペクト タイプのカテゴリをご覧ください。

  1. 省略可: 選択したプロジェクトのアスペクト タイプのリストを表示するには、[カスタム] タブをクリックし、[すべてのプロジェクトから表示] をオフに切り替えます。

[すべてのプロジェクトから表示] 切り替えボタンはデフォルトでオンになっています。リストには、選択した組織の Knowledge Catalog リソースが含まれます。

gcloud

使用可能なすべてのアスペクト タイプを一覧表示するには、gcloud dataplex aspect-types list コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge 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 ListAspectTypes</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 ListAspectTypesRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        ListAspectTypesRequest request = new ListAspectTypesRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Filter = "",
            OrderBy = "",
        };
        // Make the request
        PagedEnumerable<ListAspectTypesResponse, AspectType> response = catalogServiceClient.ListAspectTypes(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (AspectType 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 (ListAspectTypesResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (AspectType 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<AspectType> 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 (AspectType 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

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.ListAspectTypesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListAspectTypesRequest.
	}
	it := c.ListAspectTypes(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.ListAspectTypesResponse)
	}
}

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.AspectType;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.ListAspectTypesRequest;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncListAspectTypes {

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

  public static void syncListAspectTypes() 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()) {
      ListAspectTypesRequest request =
          ListAspectTypesRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (AspectType element : catalogServiceClient.listAspectTypes(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The resource name of the AspectType location, of the form:
 *  `projects/{project_number}/locations/{location_id}`
 *  where `location_id` refers to a Google Cloud region.
 */
// const parent = 'abc123'
/**
 *  Optional. Maximum number of AspectTypes to return. The service may return
 *  fewer than this value. If unspecified, the service returns at most 10
 *  AspectTypes. The maximum value is 1000; values above 1000 will be coerced
 *  to 1000.
 */
// const pageSize = 1234
/**
 *  Optional. Page token received from a previous `ListAspectTypes` call.
 *  Provide this to retrieve the subsequent page. When paginating, all other
 *  parameters you provide to `ListAspectTypes` must match the call that
 *  provided the page token.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Filter request. Filters are case-sensitive.
 *  The service supports the following formats:
 *  * labels.key1 = "value1"
 *  * labels:key1
 *  * name = "value"
 *  These restrictions can be conjoined with AND, OR, and NOT conjunctions.
 */
// const filter = 'abc123'
/**
 *  Optional. Orders the result by `name` or `create_time` fields.
 *  If not specified, the ordering is undefined.
 */
// const orderBy = 'abc123'

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callListAspectTypes() {
  // Construct request
  const request = {
    parent,
  };

  // Run request
  const iterable = dataplexClient.listAspectTypesAsync(request);
  for await (const response of iterable) {
      console.log(response);
  }
}

callListAspectTypes();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_aspect_types():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

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

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

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

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the list_aspect_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_aspect_types.
#
def list_aspect_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::ListAspectTypesRequest.new

  # Call the list_aspect_types method.
  result = client.list_aspect_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::AspectType.
    p item
  end
end

REST

使用可能なアスペクト タイプをすべて一覧表示するには、aspectTypes.list メソッドを使用します。

アスペクト タイプの詳細を表示する

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [メタデータのタイプ] ページに移動します。

    [メタデータのタイプ] に移動

  2. [アスペクト タイプ] タブをクリックします。

  3. Knowledge Catalog のアスペクト タイプの詳細を表示するには、アスペクト タイプをクリックします。アスペクト タイプの詳細ページが開きます。ここでは、表示名、アスペクト タイプ ID、説明、プロジェクト ID、ロケーション、ラベル、作成日、最終更新日などの詳細にアクセスできます。

    • 選択したアスペクト タイプの構造を表示するには、[テンプレート] タブをクリックします。
    • 最近作成された関連エントリのリスト(10 件)を表示するには、[サンプル エントリ] タブをクリックします。
    • 関連するすべてのエントリを検索するには、[検索結果の関連エントリをすべて表示] をクリックします。このボタンは、関連するエントリが 1 つ以上ある場合にのみ表示されます。

gcloud

アスペクト タイプの詳細を取得するには、gcloud dataplex aspect-types describe コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for GetAspectType</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 GetAspectTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        GetAspectTypeRequest request = new GetAspectTypeRequest
        {
            AspectTypeName = AspectTypeName.FromProjectLocationAspectType("[PROJECT]", "[LOCATION]", "[ASPECT_TYPE]"),
        };
        // Make the request
        AspectType response = catalogServiceClient.GetAspectType(request);
    }
}

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.GetAspectTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#GetAspectTypeRequest.
	}
	resp, err := c.GetAspectType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.AspectType;
import com.google.cloud.dataplex.v1.AspectTypeName;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.GetAspectTypeRequest;

public class SyncGetAspectType {

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

  public static void syncGetAspectType() 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()) {
      GetAspectTypeRequest request =
          GetAspectTypeRequest.newBuilder()
              .setName(AspectTypeName.of("[PROJECT]", "[LOCATION]", "[ASPECT_TYPE]").toString())
              .build();
      AspectType response = catalogServiceClient.getAspectType(request);
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The resource name of the AspectType:
 *  `projects/{project_number}/locations/{location_id}/aspectTypes/{aspect_type_id}`.
 */
// const name = 'abc123'

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callGetAspectType() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const response = await dataplexClient.getAspectType(request);
  console.log(response);
}

callGetAspectType();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_aspect_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

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

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

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the get_aspect_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_aspect_type.
#
def get_aspect_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::GetAspectTypeRequest.new

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

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

REST

アスペクト タイプの詳細を取得するには、aspectTypes.get メソッドを使用します。

カスタムのアスペクト タイプを更新する

カスタムのアスペクト タイプの表示名、説明、テンプレート フィールド、ラベルを更新できます。テンプレートの既存のフィールドは削除できません。

アスペクト タイプの作成後に、アスペクト タイプの ID とロケーションを更新することはできません。

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [メタデータのタイプ] ページに移動します。

    [メタデータのタイプ] に移動

  2. [アスペクト タイプ] タブをクリックします。

  3. 更新するアスペクト タイプをクリックします。

  4. [アスペクト タイプの詳細] ページで、[編集] をクリックします。

  5. 必要に応じて、表示名、説明、テンプレート フィールド、ラベルを編集します。

  6. 省略可: アスペクト タイプのフィールドを非推奨としてマークするには、次の操作を行います。

    1. [テンプレート] セクションで、フィールドを開きます。
    2. [非推奨] を選択します。
    3. [非推奨の理由] フィールドに、選択したフィールドを非推奨にする理由を入力します。
    4. [完了] をクリックします。

    5. [保存] をクリックします。

gcloud

カスタムのアスペクト タイプを更新するには、gcloud dataplex aspect-types update コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for UpdateAspectType</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 UpdateAspectTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        UpdateAspectTypeRequest request = new UpdateAspectTypeRequest
        {
            AspectType = new AspectType(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<AspectType, OperationMetadata> response = catalogServiceClient.UpdateAspectType(request);

        // Poll until the returned long-running operation is complete
        Operation<AspectType, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        AspectType 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<AspectType, OperationMetadata> retrievedResponse = catalogServiceClient.PollOnceUpdateAspectType(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            AspectType retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Go

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.UpdateAspectTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateAspectTypeRequest.
	}
	op, err := c.UpdateAspectType(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

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.AspectType;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.UpdateAspectTypeRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateAspectType {

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

  public static void syncUpdateAspectType() 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()) {
      UpdateAspectTypeRequest request =
          UpdateAspectTypeRequest.newBuilder()
              .setAspectType(AspectType.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      AspectType response = catalogServiceClient.updateAspectTypeAsync(request).get();
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. AspectType Resource
 */
// const aspectType = {}
/**
 *  Required. Mask of fields to update.
 */
// const updateMask = {}
/**
 *  Optional. Only validate the request, but do not perform mutations.
 *  The default is false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callUpdateAspectType() {
  // Construct request
  const request = {
    aspectType,
    updateMask,
  };

  // Run request
  const [operation] = await dataplexClient.updateAspectType(request);
  const [response] = await operation.promise();
  console.log(response);
}

callUpdateAspectType();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_aspect_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    aspect_type = dataplex_v1.AspectType()
    aspect_type.metadata_template.name = "name_value"
    aspect_type.metadata_template.type_ = "type__value"

    request = dataplex_v1.UpdateAspectTypeRequest(
        aspect_type=aspect_type,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the update_aspect_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_aspect_type.
#
def update_aspect_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::UpdateAspectTypeRequest.new

  # Call the update_aspect_type method.
  result = client.update_aspect_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

カスタムのアスペクト タイプを更新するには、aspectTypes.patch メソッドを使用します。

カスタムのアスペクト タイプを削除する

コンソール

  1. Google Cloud コンソールで、Knowledge Catalog の [メタデータのタイプ] ページに移動します。

    [メタデータのタイプ] に移動

  2. [アスペクト タイプ] タブをクリックします。

  3. 削除するアスペクト タイプをクリックします。

  4. [アスペクト タイプの詳細] ページで、[削除] をクリックします。表示されるメッセージを確認します。

gcloud

カスタムのアスペクト タイプを削除するには、gcloud dataplex aspect-types delete コマンドを使用します。

C#

C#

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある C# の設定手順を完了してください。詳細については、Knowledge Catalog C# API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for DeleteAspectType</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 DeleteAspectTypeRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        DeleteAspectTypeRequest request = new DeleteAspectTypeRequest
        {
            AspectTypeName = AspectTypeName.FromProjectLocationAspectType("[PROJECT]", "[LOCATION]", "[ASPECT_TYPE]"),
            Etag = "",
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = catalogServiceClient.DeleteAspectType(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.PollOnceDeleteAspectType(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

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Go の設定手順を完了してください。詳細については、Knowledge Catalog Go API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


//go:build examples

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.DeleteAspectTypeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteAspectTypeRequest.
	}
	op, err := c.DeleteAspectType(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

Java

Java

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Java の設定手順を完了してください。詳細については、Knowledge Catalog Java API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import com.google.cloud.dataplex.v1.AspectTypeName;
import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.DeleteAspectTypeRequest;
import com.google.protobuf.Empty;

public class SyncDeleteAspectType {

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

  public static void syncDeleteAspectType() 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()) {
      DeleteAspectTypeRequest request =
          DeleteAspectTypeRequest.newBuilder()
              .setName(AspectTypeName.of("[PROJECT]", "[LOCATION]", "[ASPECT_TYPE]").toString())
              .setEtag("etag3123477")
              .build();
      catalogServiceClient.deleteAspectTypeAsync(request).get();
    }
  }
}

Node.js

Node.js

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Node.js の設定手順を完了してください。詳細については、Knowledge Catalog Node.js API のリファレンス ドキュメントをご覧ください。

Knowledge 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The resource name of the AspectType:
 *  `projects/{project_number}/locations/{location_id}/aspectTypes/{aspect_type_id}`.
 */
// const name = 'abc123'
/**
 *  Optional. If the client provided etag value does not match the current etag
 *  value, the DeleteAspectTypeRequest method returns an ABORTED error
 *  response.
 */
// const etag = 'abc123'

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callDeleteAspectType() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const [operation] = await dataplexClient.deleteAspectType(request);
  const [response] = await operation.promise();
  console.log(response);
}

callDeleteAspectType();

Python

Python

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Python の設定手順を完了してください。詳細については、Knowledge Catalog Python API のリファレンス ドキュメントをご覧ください。

Knowledge 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_aspect_type():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

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

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

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

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

このサンプルを試す前に、クライアント ライブラリを使用した Knowledge Catalog のクイックスタートにある Ruby の設定手順を完了してください。詳細については、Knowledge Catalog Ruby API のリファレンス ドキュメントをご覧ください。

Knowledge Catalog への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

require "google/cloud/dataplex/v1"

##
# Snippet for the delete_aspect_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_aspect_type.
#
def delete_aspect_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::DeleteAspectTypeRequest.new

  # Call the delete_aspect_type method.
  result = client.delete_aspect_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

既存のアスペクト タイプを削除するには、aspectTypes.delete メソッドを使用します。

次のステップ