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

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

データエントリに有意義なコンテキストを追加することで、データの検出可能性と有用性を高めることが可能です。Dataplex Universal Catalog は、次の方法でコンテキストを有効にします。

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

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

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

アスペクト

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

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

  • テクニカル メタデータ: データアセットに関する技術的な詳細(スキーマなど)。

  • データから派生したメタデータ: BigQuery テーブルの統計情報など、データ自体から生成された情報。

アスペクトは、個別のリソースではなく、エントリ リソースの一部とみなされます。アスペクトを変更する場合は、アスペクトを含むエントリを変更する必要があります。

エントリの説明にはエントリレベルで、エントリ内の列の説明には列レベルでアスペクトを指定できます。

すべてのアスペクトは、アスペクト タイプのインスタンスです。アスペクト タイプは、アスペクトのテンプレートを定義します。すべてのアスペクト タイプには、一連のフィールドが含まれています。アスペクトを作成するときに、これらのフィールドの値を指定する必要があります。

特定のエントリには、アスペクト タイプごとに 1 つのアスペクトを関連付けることができます。エントリ列には、アスペクト タイプごとに複数のアスペクトを関連付けることができます。

アスペクトのカテゴリ

アスペクトは次のカテゴリに分類されます。

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

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

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

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

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

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

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

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

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

データ アスペクト

アスペクトには、データ プロファイルやサンプルクエリの結果など、データから派生した情報を含めることが可能です。これらはデータ アスペクトと呼ばれます。

アスペクト タイプ

アスペクト タイプは、アスペクトのテンプレートを提供する再利用可能なリソースです。

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

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

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

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

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

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

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

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

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

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

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

始める前に

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

必要なロール

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

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

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

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

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

API を有効にする

Dataplex Universal Catalog プロジェクトで Dataplex API を有効にします。

API を有効化

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

コンソール

  1. Google Cloud コンソールで、Dataplex Universal 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#

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

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

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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();
    }
  }
}

Python

Python

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

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

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


def sample_create_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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [検索] ページに移動します。

    検索に移動

  2. [検索プラットフォームの選択] で、検索モードとして [Dataplex Universal Catalog] を選択します。

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

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

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

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

gcloud

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

C#

C#

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

Dataplex Universal 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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);
    }
  }
}

Python

Python

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

Dataplex Universal 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

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

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

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

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

アスペクトを更新する

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

コンソール

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

    検索に移動

  2. [検索プラットフォームの選択] で、検索モードとして [Dataplex Universal Catalog] を選択します。

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

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

  4. [詳細] タブをクリックします。

  5. [タグとアスペクト] セクションで、更新するアスペクトまたはタグを展開し、[ 編集] をクリックします。

  6. [アスペクトの編集] ウィンドウで、必須フィールドを更新します。

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

gcloud

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

C#

C#

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

Dataplex Universal 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

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

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.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);
    }
  }
}

Python

Python

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

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

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


def sample_update_entry():
    # 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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [検索] ページに移動します。

    検索に移動

  2. [検索プラットフォームの選択] で、検索モードとして [Dataplex Universal Catalog] を選択します。

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

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

  4. [詳細] タブをクリックします。

  5. [タグとアスペクト] セクションで、削除するアスペクトまたはタグを展開し、 [削除] をクリックします。

  6. [確認] をクリックします。

gcloud

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

C#

C#

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

Dataplex Universal 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

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

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.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);
    }
  }
}

Python

Python

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

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

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


def sample_update_entry():
    # 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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

    カタログに移動

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

    このページでは、使用可能な Dataplex Universal Catalog アスペクト タイプと Data Catalog タグ テンプレートをすべて示します。

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

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

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

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

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

gcloud

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

C#

C#

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

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

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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);
      }
    }
  }
}

Python

Python

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

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

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


def sample_list_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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

    カタログに移動

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

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

    • 選択したアスペクト タイプの構造を表示するには、[テンプレート] タブをクリックします。
    • 最近作成された関連エントリのリスト(10 件)を表示するには、[サンプル エントリ] タブをクリックします。
    • 関連するすべてのエントリを検索するには、[検索結果の関連エントリをすべて表示] をクリックします。このボタンは、関連するエントリが 1 つ以上ある場合にのみ表示されます。
  4. Data Catalog タグ テンプレートの詳細を表示するには、タグ テンプレートをクリックします。Data Catalog でタグ テンプレートの詳細ページが開きます。ここで、表示名、テンプレート ID、プロジェクト ID、ロケーション、公開設定、ラベルなどの詳細にアクセスできます。

gcloud

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

C#

C#

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

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

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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);
    }
  }
}

Python

Python

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

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

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


def sample_get_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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

    カタログに移動

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

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

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

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

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

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

gcloud

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

C#

C#

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

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

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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();
    }
  }
}

Python

Python

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

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

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


def sample_update_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

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

Dataplex Universal 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 コンソールで、Dataplex Universal Catalog の [カタログ] ページに移動します。

    カタログに移動

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

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

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

gcloud

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

C#

C#

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

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

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for 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

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

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


package main

import (
	"context"

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

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

	req := &dataplexpb.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

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

Dataplex Universal 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();
    }
  }
}

Python

Python

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

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

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


def sample_delete_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

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

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

次のステップ