Mengelola aspek dan memperkaya metadata

Metadata sangat penting untuk mengatur dan memahami aset data Anda. Misalnya, industri yang diatur perlu melindungi informasi identitas pribadi (PII) seperti nama, alamat, dan nomor tanda pengenal yang dikeluarkan pemerintah. Data ini dapat terjadi dalam banyak instance di seluruh sistem data terdistribusi. Katalog Universal Dataplex dapat membantu Anda menemukan dan membuat katalog aset data terdistribusi dengan cepat. Kemudian, Anda dapat mengklasifikasikan data sebagai PII.

Dengan memperkaya entri data menggunakan konteks yang bermakna, Anda dapat membuat data Anda lebih mudah ditemukan dan berguna. Dataplex Universal Catalog memungkinkan konteks melalui:

  • Jenis aspek: Template JSON yang menentukan data terkait. Misalnya, untuk informasi kepatuhan, Anda mungkin memiliki klasifikasi PII dan kepatuhan terhadap GDPR.
  • Aspek: Instance dari jenis aspek. Misalnya, {"pii_classification": "confidential", "gdpr_compliant": true}. Anda dapat menerapkan aspek ke seluruh tabel atau kolom tabel tertentu.

Setelah mengklasifikasikan data, Anda dapat menerapkan kebijakan kualitas atau akses data ke data tersebut.

Untuk mengetahui informasi selengkapnya, lihat artikel Tentang pengelolaan metadata di Dataplex Universal Catalog.

Aspek

Aspek memungkinkan Anda mengambil metadata dalam entri untuk memberikan konteks yang bermakna. Anda dapat menggunakan aspek untuk menyimpan:

  • Metadata bisnis: Informasi yang memberikan konteks bisnis, seperti klasifikasi data.

  • Metadata teknis: Detail teknis tentang aset data, misalnya, skemanya.

  • Metadata turunan data: Informasi yang dihasilkan dari data itu sendiri, seperti statistik dari tabel BigQuery.

Aspek dianggap sebagai bagian dari resource entri dan bukan resource terpisah. Saat Anda mengubah aspek, Anda akan mengubah entri yang berisi aspek tersebut.

Anda dapat menentukan aspek di tingkat entri untuk mendeskripsikan entri, atau di tingkat kolom untuk mendeskripsikan kolom dalam entri.

Setiap aspek adalah instance dari jenis aspek. Jenis aspek menentukan template untuk aspeknya. Setiap jenis aspek berisi serangkaian kolom. Saat membuat aspek, Anda harus memberikan nilai untuk kolom tersebut.

Untuk entri tertentu, paling banyak ada satu aspek yang dikaitkan dengan entri, per jenis aspek. Anda dapat memiliki beberapa aspek yang terkait dengan kolom entri per jenis aspek.

Kategori aspek

Aspek dikategorikan sebagai berikut:

  • Aspek wajib diisi: aspek yang wajib diisi saat membuat entri. Aspek tersebut ditentukan oleh jenis entri dari entri tertentu. Semua entri yang termasuk dalam jenis entri harus selalu memiliki semua aspek wajib yang ditentukan oleh jenis entri tersebut.

    Dataplex Universal Catalog mengelola aspek yang diperlukan (misalnya, skema) untuk entri sistem.

    Perhatikan hal berikut:

    • Anda hanya dapat mengaitkan aspek wajib dengan entri, bukan dengan kolom entri.

    • Anda tidak dapat menghapus aspek wajib dari entri.

    • Anda dapat membaca aspek yang diperlukan dari entri sistem, tetapi tidak dapat mengubahnya.

    • Aspek data tidak dapat menjadi aspek wajib.

  • Aspek opsional: Anda dapat mengaitkan aspek opsional dengan entri atau dengan kolom entri. Anda dapat mengisi aspek opsional pada saat pembuatan entri, atau nanti dengan memperbarui entri.

    Anda dapat menghapus aspek opsional setelah diisi.

Aspek data

Aspek dapat berisi informasi yang berasal dari data, seperti hasil dari profil data atau contoh kueri. Hal ini disebut sebagai aspek data.

Jenis aspek

Jenis aspek adalah resource yang dapat digunakan kembali yang menyediakan template untuk aspek.

Kategori jenis aspek

Jenis aspek dikategorikan menjadi jenis aspek kustom dan sistem.

Jenis aspek kustom

Jenis aspek yang Anda buat di Dataplex Universal Catalog disebut jenis aspek kustom.

Jenis aspek kustom dapat bersifat global atau regional. Anda dapat membuat jenis aspek kustom baik di lokasi regional tertentu (misalnya, us-central1) atau sebagai resource global. Lokasi jenis aspek memengaruhi cakupan penerapannya dan menentukan entri mana yang dapat digunakan:

  • Jenis aspek global: Dapat digunakan untuk membuat aspek untuk entri di wilayah mana pun. Pilih jenis aspek global jika Anda perlu menerapkan struktur yang sama pada entri di beberapa wilayah, karena Anda hanya perlu menentukannya satu kali. Karena definisi jenis aspek global direplikasi di semua region, opsi ini mungkin tidak cocok jika skema jenis aspek itu sendiri berisi informasi sensitif atau jika residensi data yang ketat untuk semua komponen metadata diperlukan.
  • Jenis aspek regional: Hanya dapat digunakan untuk membuat aspek untuk entri yang berada di region yang sama dengan jenis aspek. Misalnya, jenis aspek yang dibuat di us-central1 hanya dapat digunakan dengan entri di us-central1. Pilih lokasi regional jika jenis aspek hanya relevan untuk entri di region tertentu, atau untuk memastikan bahwa definisi jenis aspek berada dalam region yang dipilih, yang dapat membantu memenuhi persyaratan kedaulatan dan kepatuhan data. Jika Anda menggunakan jenis aspek regional, tetapi memerlukan struktur yang sama di beberapa region, Anda harus membuat dan mengelola definisi jenis aspek terpisah di setiap region.

Untuk mengetahui informasi selengkapnya, lihat Batasan project dan lokasi.

Jenis aspek sistem

Jenis aspek yang disediakan, digunakan, dan dikelola oleh Dataplex Universal Catalog disebut jenis aspek sistem. Jenis aspek sistem selalu bersifat global, sehingga dapat digunakan di region mana pun. Jenis aspek sistem disimpan dalam project yang dikelola Google dengan nomor project 655216118709. Contoh, projects/655216118709/locations/global/aspectTypes/schema.

Jenis aspek sistem dikategorikan lebih lanjut menjadi dapat digunakan kembali dan dibatasi. Tabel berikut menjelaskan kategori jenis aspek sistem, dan daftar jenis aspek yang disediakan Dataplex Universal Catalog untuk setiap kategori:

Kategori jenis aspek sistem Deskripsi Jenis aspek yang disediakan Dataplex Universal Catalog
Jenis aspek sistem yang dapat digunakan kembali Anda dapat menggunakan jenis aspek ini untuk membuat atau mengubah aspek.
  • contacts
  • data-quality-scorecard
  • generic
  • overview
  • schema
  • usage
Jenis aspek sistem yang dibatasi Dataplex Universal Catalog mengelola jenis aspek ini.
Anda dapat membaca aspek dalam jenis aspek ini, tetapi tidak dapat membuat atau mengedit aspek dalam jenis aspek ini.
Termasuk, tetapi tidak terbatas pada:
  • 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

Sebelum memulai

Sebelum Anda membuat dan mengelola jenis aspek dan aspek, selesaikan tugas yang dijelaskan di bagian ini.

Peran yang diperlukan

Untuk mendapatkan izin yang Anda perlukan untuk membuat dan mengelola jenis aspek dan aspek, minta administrator Anda untuk memberi Anda peran IAM berikut pada resource:

  • Set lengkap izin pada resource metadata di Dataplex Universal Catalog, termasuk jenis aspek dan aspek data: Admin Katalog Dataplex (roles/dataplex.catalogAdmin)
  • Membuat dan mengelola resource metadata di Dataplex Universal Catalog, termasuk jenis aspek dan aspek data: Editor Katalog Dataplex (roles/dataplex.catalogEditor)
  • Set izin lengkap pada jenis aspek kustom (kecuali izin untuk menggunakan jenis aspek guna membuat atau mengedit entri): Pemilik Jenis Aspek Dataplex (roles/dataplex.aspectTypeOwner)
  • Melihat jenis aspek dan kebijakan IAM yang terkait dengannya: Dataplex Catalog Viewer (roles/dataplex.catalogViewer)
  • Gunakan jenis aspek untuk membuat dan mengubah entri dengan aspek yang sesuai: Pengguna Jenis Aspek Dataplex (roles/dataplex.aspectTypeUser)
  • Tambahkan aspek dari beberapa jenis aspek sistem, seperti schema, overview, contacts: Pemilik Entri dan EntryLink Dataplex (roles/dataplex.entryOwner)

Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.

Anda mungkin juga bisa mendapatkan izin yang diperlukan melalui peran khusus atau peran bawaan lainnya.

Untuk mengetahui informasi selengkapnya, lihat Peran IAM Dataplex Universal Catalog.

Mengaktifkan API

Aktifkan Dataplex API di project Dataplex Universal Catalog Anda.

Mengaktifkan API

Membuat jenis aspek kustom

Konsol

  1. Di konsol Google Cloud , buka halaman Katalog Dataplex Universal Catalog.

    Buka Katalog

  2. Klik tab Jenis aspek & template tag > Kustom.

  3. Klik Create aspect type.

  4. Di jendela Create aspect type, masukkan hal berikut:

    1. Opsional: Di kolom Nama tampilan, masukkan nama untuk jenis aspek.
    2. Di kolom Aspect type ID, masukkan ID unik untuk jenis aspek.
    3. Opsional: Di kolom Description, masukkan deskripsi untuk jenis aspek.
    4. Di kolom Location, pilih lokasi untuk jenis aspek. Anda tidak dapat mengubah lokasi jenis aspek setelah membuatnya. Untuk memahami dampak pemilihan lokasi global versus regional, lihat bagian Jenis aspek kustom.
  5. Opsional: Tentukan template untuk jenis aspek Anda.

    Di bagian Template, klik Add field. Di bagian Kolom baru, masukkan berikut ini:

    1. Di kolom Name, masukkan nama.
    2. Opsional: Di kolom Nama tampilan, masukkan nama tampilan.
    3. Opsional: Di kolom Deskripsi, masukkan deskripsi.
    4. Di kolom Type, pilih jenis data untuk kolom. Berdasarkan pilihan Anda, serangkaian kolom dan opsi berikutnya akan ditampilkan:

      • Jika Anda memilih Teks sebagai jenis data, ikuti langkah-langkah berikut:

        1. Di kolom Jenis teks, pilih jenis teks.
        2. Di kolom Nilai teks, berikan petunjuk untuk kolom teks. Untuk melakukannya, klik Tambahkan nilai dan masukkan petunjuk. Anda dapat menambahkan beberapa petunjuk untuk kolom teks.
        3. Klik Done.
      • Jika Anda memilih Enum sebagai jenis data, tambahkan nilai enum:

        1. Klik Add an enum value.
        2. Di kolom Nilai, masukkan nilai enum. Anda dapat menambahkan beberapa nilai enum.
        3. Klik Done.
      • Jika Anda memilih Array sebagai jenis data, di bagian Item array, tentukan jenis item yang akan ada dalam array:

        1. Klik Tambahkan item array.
        2. Di kolom Name, masukkan nama untuk item array.
        3. Opsional: Di kolom Nama tampilan, masukkan nama tampilan untuk item array.
        4. Opsional: Di kolom Description, masukkan deskripsi untuk item array.
        5. Di kolom Type, pilih jenis data untuk item array.

          Berdasarkan pilihan Anda, kumpulan kolom dan opsi berikutnya akan ditampilkan. Opsi ini serupa dengan opsi yang dijelaskan untuk jenis data Teks, Enum, Peta, Array, dan Catatan di bagian ini.

        6. Klik Done.

      • Jika Anda memilih Peta sebagai jenis data, di bagian Nilai peta, tentukan jenis nilai yang akan ada di peta:

        1. Klik Tambahkan nilai peta.
        2. Di kolom Name, masukkan nama untuk peta.
        3. Opsional: Di kolom Nama tampilan, masukkan nama tampilan untuk peta.
        4. Opsional: Di kolom Deskripsi, masukkan deskripsi untuk peta.
        5. Di kolom Type, pilih jenis data untuk peta.

          Berdasarkan pilihan Anda, kumpulan kolom dan opsi berikutnya akan ditampilkan. Opsi ini serupa dengan opsi yang dijelaskan untuk jenis data Teks, Enum, Peta, Array, dan Catatan di bagian ini.

        6. Klik Done.

      • Jika Anda memilih Rekaman sebagai jenis data, masukkan yang berikut:

        1. Di kolom ID Kumpulan Data, masukkan ID unik yang dapat digunakan oleh kolom kumpulan data lainnya untuk merujuk ke kumpulan data ini. Lihat bagian Contoh penggunaan kolom ID Kumpulan Data dan Referensi kumpulan data dalam dokumen ini.
        2. Opsional: Jika Anda ingin menambahkan referensi ke data lain dari template ini, gunakan kolom Referensi data. Anda tidak dapat mengubahnya setelah membuat jenis aspek. Lihat bagian Contoh penggunaan kolom ID Kumpulan Data dan Referensi kumpulan data dalam dokumen ini.
        3. Di bagian Kolom rekaman, Anda dapat menentukan objek kompleks dengan beberapa kolom bertingkat. Untuk melakukannya, klik Tambahkan item kolom data, lalu tentukan hal berikut:

        4. Di kolom Name, masukkan nama untuk kolom data.

        5. Opsional: Di kolom Nama tampilan, masukkan nama tampilan untuk kolom data.

        6. Opsional: Di kolom Description, masukkan deskripsi untuk kolom data.

        7. Di kolom Type, pilih jenis data.

          Berdasarkan pilihan Anda, kumpulan kolom dan opsi berikutnya akan ditampilkan. Opsi ini serupa dengan opsi yang dijelaskan untuk jenis data Teks, Enum, Peta, Array, dan Record sebelumnya di bagian ini.

        8. Klik Done.

    5. Untuk membuat kolom wajib diisi untuk aspek jenis ini, pilih Wajib diisi. Untuk mengetahui informasi selengkapnya tentang aspek wajib dan aspek opsional, lihat bagian kategori aspek dalam dokumen ini.

    6. Klik Done.

    7. Untuk menambahkan beberapa kolom, klik Tambahkan kolom dan ulangi langkah-langkah sebelumnya.

  6. Opsional: Di bagian Labels, tambahkan label arbitrer sebagai pasangan nilai kunci ke resource Anda:

    1. Klik Tambahkan label.
    2. Di kolom Key, masukkan kunci.
    3. Di kolom Nilai, masukkan nilai untuk kunci.
    4. Untuk menambahkan label lainnya, klik Tambahkan label, lalu ulangi langkah-langkahnya.
  7. Klik Simpan.

gcloud

Untuk membuat jenis aspek kustom, gunakan perintah gcloud dataplex aspect-types create.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk membuat jenis aspek kustom, gunakan metode aspectType.create.

Setelah membuat jenis aspek kustom, Anda dapat menambahkan aspek ke entri.

Contoh penggunaan kolom ID Data dan Referensi data

Anda dapat menggunakan kolom ID Rekaman dan Referensi rekaman untuk referensi rekursif. Contoh berikut menunjukkan cara menggunakan kolom ini:

Pertimbangkan jenis aspek yang disebut Employee, dengan kolom berikut:

  • Nama (jenis:Text)
  • Tanggal mulai (jenis:Date & time)
  • Jabatan (jenis:Text)
  • Alamat saat ini (jenis:Record)
  • Alamat tetap (jenis:Record)

Dua kolom alamat Alamat saat ini dan Alamat permanen memiliki jenis data Record yang sama. Untuk menghindari duplikasi, Anda dapat menetapkan nilai ID Record dan Referensi record saat menentukan kolom ini.

Saat menentukan kolom Alamat saat ini, Anda dapat menentukan ID Rekaman sebagai address-field. Untuk Alamat tetap, Anda dapat menentukan nilai yang sama (address-field) untuk Referensi catatan. Contoh:

  • Nama (jenis:Text)
  • Tanggal mulai (jenis:Date & time)
  • Jabatan (jenis:Text)
  • Alamat saat ini (jenis:Record, ID Data:address-field)
  • Alamat tetap (jenis:Record, Referensi catatan:address-field)

Dengan begitu, Anda tidak perlu menduplikasi kolom alamat lain.

Menambahkan aspek ke entri

Setelah membuat jenis aspek, Anda dapat membuat aspek dari jenis tersebut. Untuk menambahkan aspek ke entri, Anda harus memperbarui entri, karena aspek disimpan dalam entri.

Perhatikan hal berikut:

  • Anda dapat menambahkan aspek ke entri atau ke kolom entri.
  • Anda hanya dapat mengedit aspek yang diperlukan untuk entri kustom. Anda tidak dapat menghapus aspek yang diperlukan.
  • Anda dapat mengedit dan menghapus aspek opsional untuk entri kustom dan entri sistem.

Konsol

  1. Di konsol Google Cloud , buka halaman Penelusuran Dataplex Universal Catalog.

    Buka Penelusuran

  2. Untuk Pilih platform penelusuran, pilih Dataplex Universal Catalog sebagai mode penelusuran.

  3. Telusuri entri yang ingin Anda tambahi aspek, lalu klik entri tersebut. Halaman detail entri akan terbuka.

  4. Untuk menambahkan aspek ke entri, ikuti langkah-langkah berikut:

    1. Klik tab Details.
    2. Untuk menambahkan aspek wajib atau aspek opsional ke entri, di bagian Tag & aspek, klik Tambahkan untuk masing-masing kategori.
      Anda tidak dapat menambahkan aspek yang diperlukan jika jenis entri dari entri yang dipilih tidak memiliki aspek yang diperlukan.
    3. Telusuri dan pilih aspek yang ingin Anda tambahkan.
    4. Di jendela Tambahkan aspek, masukkan nilai untuk kolom.
    5. Klik Simpan.
  5. Untuk menambahkan aspek ke kolom entri, ikuti langkah-langkah berikut:

    1. Di halaman detail entri, klik tab Schema.
    2. Pilih kolom yang ingin Anda tambahi aspek.
    3. Klik Tambahkan aspek.
    4. Telusuri dan pilih aspek yang ingin Anda tambahkan.
    5. Di jendela Tambahkan aspek, masukkan nilai untuk kolom.
    6. Klik Simpan.

gcloud

Untuk menambahkan aspek ke entri atau ke kolom entri, gunakan perintah gcloud dataplex entries update.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk menambahkan aspek ke objek entri, lihat Aspek.

Go

Go

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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
}

Untuk menambahkan aspek ke objek entri, lihat Entri.

Java

Java

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk menambahkan aspek ke objek entri, lihat #required_aspects=.

REST

Untuk menambahkan aspek ke entri atau ke kolom entri, gunakan metode entry.patch.

Membuat dan menggunakan aspek dalam entri yang jenis aspek dan entrinya berada di organisasi Google Cloud yang berbeda tidak didukung.

Mengelola aspek yang ada untuk entri

Bagian ini menjelaskan cara memperbarui dan menghapus aspek yang ada untuk entri.

Memperbarui aspek

Anda dapat mengedit aspek opsional untuk entri kustom dan entri sistem. Anda hanya dapat mengedit aspek yang diperlukan untuk entri kustom.

Konsol

  1. Di konsol Google Cloud , buka halaman Penelusuran Dataplex Universal Catalog.

    Buka Penelusuran

  2. Untuk Pilih platform penelusuran, pilih Dataplex Universal Catalog sebagai mode penelusuran.

  3. Cari entri yang aspeknya ingin Anda perbarui, lalu klik entri tersebut.

    Halaman detail entri akan terbuka.

  4. Klik tab Details.

  5. Di bagian Tag & aspek, luaskan aspek atau tag yang ingin Anda perbarui, lalu klik Edit.

  6. Di jendela Edit aspek, perbarui kolom yang wajib diisi.

  7. Klik Simpan.

gcloud

Untuk memperbarui aspek entri atau kolom entri, gunakan perintah gcloud dataplex entries update.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk memperbarui aspek entri atau kolom entri, gunakan metode entry.patch.

Menghapus aspek

Konsol

  1. Di konsol Google Cloud , buka halaman Penelusuran Dataplex Universal Catalog.

    Buka Penelusuran

  2. Untuk Pilih platform penelusuran, pilih Dataplex Universal Catalog sebagai mode penelusuran.

  3. Telusuri entri yang aspeknya ingin Anda hapus, lalu klik entri tersebut.

    Halaman detail entri akan terbuka.

  4. Klik tab Details.

  5. Di bagian Tag & aspek, luaskan aspek atau tag yang ingin Anda hapus, lalu klik Hapus.

  6. Klik Konfirmasi.

gcloud

Untuk menghapus aspek entri, gunakan perintah gcloud dataplex entries update.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk menghapus aspek entri, gunakan metode entry.patch.

Mengelola jenis aspek

Bagian ini menjelaskan cara melihat, memperbarui, dan menghapus jenis aspek.

Melihat daftar jenis aspek dan template tag yang tersedia

Konsol

  1. Di konsol Google Cloud , buka halaman Katalog Dataplex Universal Catalog.

    Buka Katalog

  2. Klik tab Jenis aspek & template tag.

    Halaman ini mencantumkan semua jenis aspek Katalog Universal Dataplex dan template tag Data Catalog yang tersedia.

  3. Untuk melihat jenis aspek kustom dan template tag, klik tab Kustom. Di tab Kustom, kolom Sumber katalog menampilkan tempat resource berada—Dataplex Universal Catalog atau Data Catalog.

    Untuk melihat jenis aspek sistem, klik tab Sistem.

    Untuk mengetahui informasi selengkapnya tentang jenis aspek kustom dan sistem, lihat bagian kategori jenis aspek dalam dokumen ini.

  4. Opsional: Untuk melihat daftar jenis aspek dan template tag di project yang Anda pilih, klik tab Kustom, lalu klik tombol Tampilkan dari semua project ke posisi nonaktif.

    Tombol Show from all projects aktif secara default, dan daftar mencakup resource Dataplex Universal Catalog dari organisasi yang Anda pilih dan resource Data Catalog dari semua organisasi yang dapat Anda akses.

gcloud

Untuk mencantumkan semua jenis aspek yang tersedia, gunakan perintah gcloud dataplex aspect-types list.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk mencantumkan semua jenis aspek yang tersedia, gunakan metode aspectTypes.list.

Melihat detail jenis aspek atau template tag

Konsol

  1. Di konsol Google Cloud , buka halaman Katalog Dataplex Universal Catalog.

    Buka Katalog

  2. Klik tab Jenis aspek & template tag.

  3. Untuk melihat detail jenis aspek Dataplex Universal Catalog, klik jenis aspek. Halaman detail jenis aspek akan terbuka, tempat Anda dapat mengakses detail, seperti nama tampilan, ID jenis aspek, deskripsi, ID project, lokasi, label, tanggal pembuatan, dan tanggal terakhir diubah.

    • Untuk melihat struktur jenis aspek yang dipilih, klik tab Template.
    • Untuk melihat daftar 10 entri terkait yang dibuat baru-baru ini, klik tab Contoh entri.
    • Untuk menelusuri semua entri terkait, klik Tampilkan semua entri terkait di Penelusuran. Tombol ini hanya muncul jika ada minimal satu entri terkait.
  4. Untuk melihat detail template tag Data Catalog, klik template tag. Halaman detail template tag akan terbuka di Data Catalog, tempat Anda dapat mengakses detail, seperti nama tampilan, ID template, ID project, lokasi, visibilitas, dan label.

gcloud

Untuk mendapatkan detail jenis aspek, gunakan perintah gcloud dataplex aspect-types describe.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk mendapatkan detail jenis aspek, gunakan metode aspectTypes.get.

Memperbarui jenis aspek kustom

Anda dapat memperbarui nama tampilan, deskripsi, kolom template, dan label dari jenis aspek kustom. Anda tidak dapat menghapus kolom yang ada dalam template.

Anda tidak dapat memperbarui ID jenis aspek dan lokasi setelah membuat jenis aspek.

Konsol

  1. Di konsol Google Cloud , buka halaman Katalog Dataplex Universal Catalog.

    Buka Katalog

  2. Klik tab Jenis aspek & template tag.

  3. Klik jenis aspek yang ingin Anda perbarui.

  4. Di halaman Aspect type details, klik Edit.

  5. Edit nama tampilan, deskripsi, kolom template, dan label, sesuai kebutuhan.

  6. Opsional: Untuk menandai kolom dalam jenis aspek sebagai tidak digunakan lagi, ikuti langkah-langkah berikut:

    1. Di bagian Template, luaskan kolom.
    2. Pilih Tidak Digunakan Lagi.
    3. Di kolom Alasan penghentian penggunaan, masukkan alasan penghentian penggunaan kolom yang dipilih.
    4. Klik Done.
  7. Klik Save.

gcloud

Untuk memperbarui jenis aspek kustom, gunakan perintah gcloud dataplex aspect-types update.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk memperbarui jenis aspek kustom, gunakan metode aspectTypes.patch.

Menghapus jenis aspek kustom

Konsol

  1. Di konsol Google Cloud , buka halaman Katalog Dataplex Universal Catalog.

    Buka Katalog

  2. Klik tab Jenis aspek & template tag.

  3. Klik jenis aspek yang ingin Anda hapus.

  4. Di halaman Detail jenis aspek, klik Hapus. Konfirmasi saat diminta.

gcloud

Untuk menghapus jenis aspek kustom, gunakan perintah gcloud dataplex aspect-types delete.

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi C# API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Go API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Java API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Python API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# 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

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Dataplex Universal Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Ruby API Dataplex Universal Catalog.

Untuk melakukan autentikasi ke Katalog Universal Dataplex, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

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

Untuk menghapus jenis aspek kustom yang ada, gunakan metode aspectTypes.delete.

Langkah berikutnya