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

メタデータは、データアセットとそれらの間の関係を整理して理解するうえで不可欠です。たとえば、規制対象の業界では、名前、住所、政府機関発行の身分証明書などの個人情報(PII)を保護する必要があります。このデータは、分散データシステム全体で多数のインスタンスで発生する可能性があります。Knowledge Catalog(旧称: Dataplex Universal Catalog)を使用すると、分散データアセットをすばやく検出してカタログに登録できます。その後、データを PII として分類できます。

データエントリとエントリリンクに有意義なコンテキストを追加することで、データの検出可能性と有用性を高めることが可能です。Knowledge Catalog では、アスペクト タイプとアスペクトを使用してコンテキストを有効にします。

  • アスペクト タイプ: 関連データを定義する JSON テンプレート。たとえば、コンプライアンス情報には、PII の分類と GDPR 準拠が含まれる場合があります。
  • アスペクト: アスペクト タイプのインスタンス。たとえば、{"pii_classification": "confidential", "gdpr_compliant": true}。アスペクトは、テーブル全体、個々のテーブル列、またはエントリリンクに適用できます。

データを分類したら、データ品質ポリシーまたはアクセス ポリシーをデータに適用できます。

詳細については、Knowledge Catalog のメタデータについてをご覧ください。

アスペクト タイプとは

アスペクト タイプは、アスペクトのテンプレートを提供する再利用可能なリソースです。カスタム アスペクト タイプを作成する場合は、Knowledge Catalog リソースの命名ガイドラインに準拠した ID を指定する必要があります。

アスペクト タイプのカテゴリ

アスペクト タイプは、カスタム アスペクト タイプとシステム アスペクト タイプに分類されます。

カスタムのアスペクト タイプ

Knowledge Catalog で作成するアスペクト タイプは、カスタム アスペクト タイプと呼ばれます。

カスタム アスペクト タイプは、グローバルまたはリージョンにできます。

  • グローバル アスペクト タイプ: 任意のリージョンのエントリのアスペクトを作成するために使用できます。複数のリージョンにわたってエントリに同じ構造を適用する必要がある場合は、global アスペクト タイプを選択します。このタイプは 1 回定義するだけで済みます。グローバル アスペクト タイプの定義はすべてのリージョンに複製されるため、アスペクト タイプのスキーマ自体に機密情報が含まれている場合や、すべてのメタデータ コンポーネントに厳格なデータ所在地が必要な場合は、このオプションが適していない可能性があります。
  • リージョンのアスペクト タイプ: アスペクト タイプと同じリージョンに存在するエントリのアスペクトを作成する場合にのみ使用できます。たとえば、us-central1 で作成されたアスペクト タイプは、us-central1 のエントリでのみ使用できます。アスペクト タイプが特定のリージョンのエントリにのみ関連する場合、またはアスペクト タイプ定義が選択したリージョン内に存在するようにする場合は、リージョンのロケーションを選択します。これにより、データ主権とコンプライアンスの要件を満たすことができます。リージョンのアスペクト タイプを使用しているが、複数のリージョンで同じ構造が必要な場合は、各リージョンで個別の側面タイプ定義を作成して管理する必要があります。

カスタム アスペクト タイプは、特定のリージョン ロケーション(us-central1 など)で、または global リソースとして作成できます。アスペクト タイプのロケーションは、適用範囲に影響し、使用できるエントリを決定します。

詳細については、プロジェクトとロケーションの制約をご覧ください。

システムのアスペクト タイプ

Knowledge Catalog が提供、使用、管理するアスペクト タイプは、システムのアスペクト タイプと呼ばれます。システムのアスペクト タイプは常にグローバルであるため、どのリージョンでも使用できます。システムのアスペクト タイプは、プロジェクト ID 655216118709 の Google マネージド プロジェクトに保存されます。例: projects/655216118709/locations/global/aspectTypes/schema

システム定義のアスペクト タイプ、エントリタイプ、エントリリンク タイプにはそれぞれ独自の IAM 権限があります。詳細については、システム アスペクト タイプ、エントリタイプ、エントリリンク タイプの IAM 権限をご覧ください。

システム アスペクト タイプは、再利用可能と制限付きにさらに分類されます。次の表に、システム アスペクト タイプのカテゴリと、各カテゴリに Knowledge Catalog が提供するアスペクト タイプのリストを示します。

システム アスペクト タイプのカテゴリ 説明 Knowledge Catalog が提供するアスペクト タイプ
再利用可能なシステム アスペクト タイプ これらのアスペクト タイプを使用して、アスペクトを作成または変更できます。
  • contacts
  • data-profile
  • data-quality-scorecard
  • generic
  • graph-profile
  • guidelines
  • overview
  • schema-join
  • schema
  • storage
  • usage
制限付きシステム アスペクト タイプ これらのアスペクト タイプは Knowledge Catalog によって管理されます。
これらのアスペクト タイプではアスペクトを読み取ることができますが、アスペクトの作成や編集はできません。
以下を含みます(ただしこれらに限定されません)。
  • analytics-hub
  • aspecttype-aspect
  • bigquery-dataset
  • bigquery-table
  • cloudsql-database
  • cloudsql-instance
  • cloudsql-table
  • entrygroup-aspect
  • entrytype-aspect
  • sensitive-data-protection-profile
  • storage-bucket
  • storage-folder

アスペクトとは

アスペクトを使用すると、エントリまたはエントリリンク内のメタデータをキャプチャして、有意義なコンテキストを提供できます。アスペクトを使用して、次のタイプのメタデータを保存できます。

  • ビジネス メタデータ: データ分類など、ビジネス コンテキストを提供する情報。

  • テクニカル メタデータ: エントリまたはエントリリンクの技術的な詳細。次のものがあります。

    • エントリの場合: データアセット自体の詳細(スキーマなど)。
    • エントリ リンクの場合: データアセット間の関係の詳細(結合の詳細など)。
  • データから派生したメタデータ: BigQuery テーブルの統計情報など、データ自体から生成された情報。

アスペクトは、個別のスタンドアロン リソースではなく、親エントリ リソースの構成要素です。アスペクトを変更すると、そのアスペクトを含むエントリが更新されます。これらの変更を追跡するには、メタデータ変更フィードを購読します。

アスペクトの配置とターゲット レベル

各アスペクトは、アスペクト タイプのテンプレートのインスタンスです。このテンプレートは、入力する必要があるフィールドを定義します。アスペクトを適用できる場所と、アスペクトを適用できる回数は、ターゲット リソースタイプによって異なります。

ターゲット リソース サポートされているレベル 基数の上限
エントリ エントリレベルまたは列レベル エントリ レベルでは、アスペクト タイプごとに 1 つのアスペクトのみが許可されます。アスペクト タイプごとに複数のアスペクトを異なる列に含めることができます。
エントリリンク リンクレベルのみ リンクごとにアスペクト タイプごとに 1 つのアスペクト。

アスペクトのカテゴリ

アスペクトは、必須アスペクトとオプションのアスペクトに分類されます。

必須アスペクト

必須アスペクトは、エントリまたはエントリリンクの作成時に必須のアスペクトです。このようなアスペクトは、エントリタイプまたはエントリリンクタイプによって定義されます。特定のタイプに属するすべてのリソースには、そのタイプで定義されているすべての必須アスペクトが常に存在する必要があります。

Knowledge Catalog は、システム エントリに必要なアスペクト(スキーマなど)を管理します。

次の点にご注意ください。

  • 必須アスペクトはエントリにのみ関連付けることができ、その列には関連付けられません。

  • エントリまたはエントリリンクから必須アスペクトを削除することはできません。

  • システム エントリの必須アスペクトは読み取れますが、変更はできません。

  • データ アスペクトは必須アスペクトにできません。

オプションのアスペクト

オプションのアスペクトは、エントリまたはエントリ列に関連付けることができます。オプションのアスペクトは、エントリの作成時に入力するか、後でエントリを更新して入力できます。

次の点にご注意ください。

  • オプションのアスペクトは、入力した後に削除できます。

  • エントリ リンクは必須アスペクトのみをサポートします。

データ アスペクト

一部のアスペクトには、エントリのメタデータではなく、エントリの基盤となるデータから派生した情報が含まれています。これらはデータ アスペクトと呼ばれます。たとえば、データ プロファイル スキャンやデータ品質スキャンの結果には、データ自体から導出された統計情報が含まれているため、データ アスペクトとして分類されます。

データ アスペクトであるシステム アスペクト タイプには、次のものがあります。

始める前に

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

必要なロール

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

  • アスペクト タイプやデータ アスペクトなど、Knowledge Catalog のメタデータ リソースに対する完全な権限セット: Dataplex Catalog 管理者 roles/dataplex.catalogAdmin
  • アスペクト タイプやデータ アスペクトなど、Knowledge Catalog でメタデータ リソースを作成、管理する: Dataplex Catalog 編集者 roles/dataplex.catalogEditor
  • カスタム アスペクト タイプに対するすべての権限(アスペクト タイプを使用してエントリを作成または編集する権限を除く): Dataplex アスペクト タイプ オーナー roles/dataplex.aspectTypeOwner
  • アスペクト タイプとそれに関連付けられた IAM ポリシーを表示する: Dataplex Catalog 閲覧者 roles/dataplex.catalogViewer
  • アスペクト タイプを使用して、対応するアスペクトを持つエントリを作成および変更する: Dataplex アスペクト タイプ ユーザー roles/dataplex.aspectTypeUser
  • schemaschema-joinoverviewcontacts などのシステム アスペクト タイプのアスペクトを追加する: Dataplex エントリと EntryLink オーナー roles/dataplex.entryOwner

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

必要な権限は、カスタムロールや他の事前定義ロールから取得することもできます。

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

API を有効にする

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

API を有効にする

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

コンソール

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

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

  2. [アスペクト タイプとタグ テンプレート] > [カスタム] タブをクリックします。

  3. [アスペクト タイプを作成する] をクリックします。

  4. [アスペクト タイプを作成する] ウィンドウで、次のように入力します。

    1. 省略可: [表示名] フィールドに、アスペクト タイプの名前を入力します。
    2. [アスペクト タイプ ID] フィールドに、アスペクト タイプの一意の ID を入力します。
    3. 省略可: [説明] フィールドに、アスペクト タイプの説明を入力します。
    4. [ロケーション] フィールドで、アスペクト タイプのロケーションを選択します。作成後にアスペクト タイプのロケーションを変更することはできません。グローバル ロケーションとリージョン ロケーションの選択による影響については、カスタムのアスペクト タイプのセクションをご覧ください。
  5. 省略可: アスペクト タイプのテンプレートを定義します。

    [テンプレート] セクションで、[フィールドを追加] をクリックします。[新規フィールド] セクションに、次の情報を入力します。

    1. [名前] フィールドに名前を入力します。
    2. 省略可: [表示名] フィールドに表示名を入力します。
    3. 省略可: [説明] フィールドに説明を入力します。
    4. [] フィールドで、フィールドのデータ型を選択します。選択内容に応じて、次のフィールドとオプションが表示されます。

      • データ型として [テキスト] を選択した場合は、次の手順を行います。

        1. [テキスト型] フィールドで、テキストの型を選択します。
        2. [テキスト値] フィールドに、テキスト フィールドのヒントを指定します。これを行うには、[値を追加] をクリックしてヒントを入力します。テキスト フィールドには複数のヒントを追加できます。
        3. [完了] をクリックします。
      • データ型として [列挙型] を選択した場合は、列挙値を追加します。

        1. [列挙値を追加] をクリックします。
        2. [] フィールドに列挙値を入力します。複数の列挙値を追加できます。
        3. [完了] をクリックします。
      • データ型として [配列] を選択した場合は、[配列項目] セクションで、配列に存在する項目の型を定義します。

        1. [配列項目を追加] をクリックします。
        2. [名前] フィールドに、配列項目の名前を入力します。
        3. 省略可: [表示名] フィールドに、配列項目の表示名を入力します。
        4. 省略可: [説明] フィールドに、配列項目の説明を入力します。
        5. [] フィールドで、配列項目のデータ型を選択します。

          選択内容に応じて、次の一連のフィールドとオプションが表示されます。これらのオプションは、このセクションの他の箇所で説明されているデータ型であるテキスト列挙型マップ配列レコードのオプションと類似しています。

        6. [完了] をクリックします。

      • データ型として [マップ] を選択した場合は、[マップ値] セクションで、マップに存在する値の型を定義します。

        1. [マップ値を追加] をクリックします。
        2. [名前] フィールドに、マップの名前を入力します。
        3. 省略可: [表示名] フィールドに、マップの表示名を入力します。
        4. 省略可: [説明] フィールドに、マップの説明を入力します。
        5. [] フィールドで、マップのデータ型を選択します。

          選択内容に応じて、次の一連のフィールドとオプションが表示されます。これらのオプションは、このセクションの他の箇所で説明されているデータ型であるテキスト列挙型マップ配列レコードのオプションと類似しています。

        6. [完了] をクリックします。

      • データ型として [記録] を選択した場合は、次のように入力します。

        1. [レコード ID] フィールドに、他のレコード フィールドがこのレコードを参照するために使用できる一意の ID を入力します。このドキュメントのレコード ID フィールドとレコード参照フィールドの使用例をご覧ください。
        2. 省略可: このテンプレートの別のレコードへの参照を追加する場合は、[レコード参照] フィールドを使用します。アスペクト タイプを作成した後にこの値を変更することはできません。このドキュメントのレコード ID フィールドとレコード参照フィールドの使用例をご覧ください。
        3. [レコード フィールド] セクションでは、複数のネストされたフィールドを持つ複雑なオブジェクトを定義できます。これを行うには、[レコード フィールド項目の追加] をクリックして、次の値を指定します。

        4. [名前] フィールドに、レコード フィールドの名前を入力します。

        5. 省略可: [表示名] フィールドに、レコード フィールドの表示名を入力します。

        6. 省略可: [説明] フィールドにレコード フィールドの説明を入力します。

        7. [] フィールドでデータ型を選択します。

          選択内容に応じて、次の一連のフィールドとオプションが表示されます。これらのオプションは、このセクションで前述したデータ型であるテキスト列挙型マップ配列レコードのオプションに類似しています。

        8. [完了] をクリックします。

    5. このタイプのアスペクトでフィールドを必須にするには、[必須] を選択します。必須アスペクトとオプションのアスペクトの詳細については、このドキュメントのアスペクトのカテゴリ セクションをご覧ください。

    6. [完了] をクリックします。

    7. 複数のフィールドを追加するには、[フィールドを追加] をクリックして、前の手順を繰り返します。

  6. 省略可: [ラベル] セクションで、任意のラベルを Key-Value ペアとしてリソースに追加します。

    1. [ラベルを追加] をクリックします。
    2. [キー] フィールドにキーを入力します。
    3. [] フィールドにキーの値を入力します。
    4. ラベルをさらに追加するには、[ラベルを追加] をクリックしてこの手順を繰り返します。
  7. [保存] をクリックします。

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] と [レコード参照] の値を設定します。

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

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

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

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

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

次の点にご注意ください。

  • アスペクトはエントリまたはエントリの列に追加できます。
  • 必須アスペクトを編集できるのは、カスタム エントリの場合のみです。必須アスペクトは削除できません。
  • カスタム エントリとシステム エントリの両方で、オプションのアスペクトを編集および削除できます。

コンソール

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

    [検索] に移動

  2. 検索プラットフォームが [Data Catalog] に設定されている場合は、[検索プラットフォームの選択] メニューで [Dataplex Universal Catalog] を選択します。

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

  4. エントリにアスペクトを追加する手順は次のとおりです。

    1. [詳細] タブをクリックします。
    2. エントリに必須アスペクトまたはオプションのアスペクトを追加するには、[タグとアスペクト] セクションで、該当するカテゴリの [追加] をクリックします。
      選択したエントリのエントリタイプに必須アスペクトが定義されていない場合、必須アスペクトを追加することはできません。
    3. 追加するアスペクトを検索して選択します。
    4. [アスペクトを追加] ウィンドウで、フィールドの値を入力します。
    5. [保存] をクリックします。

    6. エントリの列にアスペクトを追加する手順は次のとおりです。

    7. [エントリの詳細] ページで [スキーマ] タブをクリックします。

    8. アスペクトを追加する列を選択します。

    9. [アスペクトを追加] をクリックします。

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

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

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

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 組織にあるエントリでアスペクトを作成して使用することはできません。

再利用可能なシステム アスペクト タイプのアスペクトを関連付ける

再利用可能なシステム アスペクト タイプのアスペクトをエントリに添付できます。

再利用可能なアスペクト タイプの側面は、その構造に応じて Google Cloud コンソールで編集できます。ネストされたフィールドを含むアスペクト タイプは、 Google Cloud コンソールでの編集がサポートされていません。このタイプの側面を関連付けるか更新するには、gcloud コマンドライン ツールまたは REST API を使用する必要があります。

データ品質スコアカード

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

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

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

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

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

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

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

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

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

    • score: ディメンション レベルの総合スコア。範囲は [0, 100] です。

    • status: ディメンションのステータス。品質しきい値(PASS または FAIL)を満たしているかどうかを示します。

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

    • name: 列の名前。

    • score: 列レベルの総合スコア(0 ~ 100)。

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

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

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

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

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

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

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

gcloud

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

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

      {
        "dataplex-types.global.data-quality-scorecard": {
          "data": {
            "score": 0.8,
            "status": "PASS",
            "dimensions": [
              {
                "name": "completeness",
                "score": 0.9,
                "status": "PASS"
              },
              {
                "name": "uniqueness",
                "score": 0.7,
                "status": "FAIL"
              }
            ],
            "columns": [
              {
                "name": "col1",
                "score": 0.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

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

次のシステム アスペクト タイプも使用できます。データ品質スコアカードで示されているのと同じ gcloud または REST API メソッドを使用して、これらを関連付けることができます。ネストされたフィールドのないアスペクト タイプ(generic など)の場合は、コンソールを使用できます。

  • Contacts. contacts アスペクト タイプを使用して、所有権またはスチュワードシップを割り当てます。フィールドには次のものがあります。

    • identities(配列): 連絡先のリスト。各連絡先には次の情報が含まれます。
      • role(文字列): 連絡先の役割(ownerstewardproduceradmin など)。
      • name(文字列): 連絡先の名前。
      • id(文字列): 連絡先のメールアドレスまたは ID。

    次のように payload.json ファイルを作成します。

     {
       "aspects": {
         "dataplex-types.global.contacts": {
           "data": {
             "identities": [
               {
                 "role": "steward",
                 "name": "Jane Doe",
                 "id": "jane.doe@example.com"
               }
             ]
           }
         }
       }
     }
    
  • データ プロファイル。data-profile アスペクト タイプを使用して、データ プロファイリングの結果を取得します。詳細については、データのプロファイリングについてをご覧ください。

    フィールドには次のものがあります。

    • sourceDataInfo(レコード): プロファイルの生成に使用されたスキャン対象のソースデータに関する情報。
      • scope(列挙型): プロファイルのスコープ(PREVIEWSAMPLEDALL)。PREVIEW 値は、軽量プロファイリング スキャンの結果に対応します。
      • scannedRows(int): スキャンされた行数。
      • samplingPercentage(double): 使用されたサンプリングの割合。
    • fields(マップ): 列名とそのデータ プロファイルのマップ。uniquenessnullnesstopN の値などの指標と、numericstringdatetimearray 列の型固有の統計情報が含まれます。

    次のように payload.json ファイルを作成します。

     {
       "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
            }
          }
             }
           }
         }
       }
     }}
    
  • グラフ プロファイル。graph-profile アスペクト タイプ(dataplex-types.global.graph-profile)は、非構造化データ分析情報から推論されたセマンティック構造(ノード、エッジ、フィールド)をキャプチャする AI 生成のシステム アスペクトです。Knowledge Catalog では、スキャン実行時にこのアスペクトが自動的に関連付けられますが、REST API を使用して、推論された分析情報を手動で更新または絞り込むことができます。詳細な手順とペイロードの例については、推論された分析情報を更新するをご覧ください。

  • 汎用。一般的なエントリ情報には generic アスペクト タイプを使用します。フィールドには次のものがあります。

    • type(文字列): ユーザー指定のタイプを保存するフリーフォーム フィールド。
    • system(文字列): カスタム エントリのシステム。

    次のように payload.json ファイルを作成します。

    {
      "aspects": {
        "dataplex-types.global.generic": {
          "data": {
            "type": "custom-type",
            "system": "custom-system"
          }
        }
      }
    }
    
  • 全ウィンドウ表示。overview アスペクト タイプを使用して、リッチテキストの説明を指定します。フィールドには次のものがあります。

    • content(文字列): エントリの概要。HTML 形式をサポートしています。
    • links(配列): ソースシステム リンクのリスト。各リンクには次のものが含まれます。
      • url(文字列): リンクの URL。
      • title(文字列): リンクのタイトル。

    次のように payload.json ファイルを作成します。

    {
      "aspects": {
        "dataplex-types.global.overview": {
          "data": {
            "content": "This is a <b>rich text</b> description.",
          "links": [
            {
              "url": "https://example.com",
              "title": "Example Link"
            }
          ]
        }
      }
    }}
    
  • Schema. schema アスペクト タイプを使用して、データの構造を記述します。

    • fields(配列): スキーマ フィールドのリスト。フィールドには次のものが含まれます。
      • name(文字列): フィールドの名前。
      • dataType(文字列): フィールドのデータ型。
      • metadataType(列挙型): メタデータのタイプ(STRINGBOOLEAN など)。
      • mode(列挙型): フィールドのモード(NULLABLEREQUIREDREPEATED)。
      • description(文字列): フィールドの説明。

    次のように payload.json ファイルを作成します。

    {
      "aspects": {
        "dataplex-types.global.schema": {
          "data": {
            "fields": [
            {
              "name": "id",
              "dataType": "string",
              "metadataType": "STRING",
              "mode": "REQUIRED"
            }
          ]
        }
      }
    }}
    
  • 使用状況。使用状況指標を追跡するには、usage アスペクト タイプを使用します。フィールドには次のものがあります。

    • metrics(配列): 使用状況指標のリスト。各指標には次のものが含まれます。
      • name(文字列): 指標の名前(viewsreads など)。
      • timeSeries(配列): 時系列データのリスト。各アイテムには次の情報が含まれます。
        • interval(文字列): 集計間隔(30d など)。
        • value(整数): 集計値。
    • refreshTime(datetime): 指標が最後に更新された時刻。

    次のように payload.json ファイルを作成します。

    {
      "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

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

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

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

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

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

アスペクトを更新する

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

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

コンソール

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

    [検索] に移動

  2. 検索プラットフォームが [Data Catalog] に設定されている場合は、[検索プラットフォームの選択] メニューで [Dataplex Universal Catalog] を選択します。

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

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

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

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.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. 検索プラットフォームが [Data Catalog] に設定されている場合は、[検索プラットフォームの選択] メニューで [Dataplex Universal Catalog] を選択します。

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

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

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

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.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 アスペクト タイプと Data Catalog タグ テンプレートがすべて一覧表示されます。

  1. カスタム アスペクト タイプとタグ テンプレートを表示するには、[カスタム] タブをクリックします。[カスタム] タブの [カタログソース] 列に、リソースが存在する場所(Knowledge Catalog または Data Catalog)が表示されます。

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

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

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

[すべてのプロジェクトから表示] 切り替えボタンはデフォルトでオンになっています。リストには、選択した組織の Knowledge Catalog リソースと、アクセスできるすべての組織の Data 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 つ以上ある場合にのみ表示されます。
  4. Data Catalog タグ テンプレートの詳細を表示するには、タグ テンプレートをクリックします。Data Catalog でタグ テンプレートの詳細ページが開きます。ここで、表示名、テンプレート ID、プロジェクト ID、ロケーション、公開設定、ラベルなどの詳細にアクセスできます。

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 メソッドを使用します。

次のステップ