Mengelola produk data

Dokumen ini ditujukan bagi pemilik produk data yang ingin memperbarui, menghapus, dan memberikan akses ke produk data di Knowledge Catalog (sebelumnya Dataplex Universal Catalog).

Untuk mengetahui informasi selengkapnya tentang arsitektur dan konsep utama produk data, lihat Tentang produk data.

Sebelum memulai

  1. Aktifkan Dataplex dan BigQuery API.

    Peran yang diperlukan untuk mengaktifkan API

    Untuk mengaktifkan API, Anda memerlukan peran IAM Service Usage Admin (roles/serviceusage.serviceUsageAdmin), yang berisi izin serviceusage.services.enable. Pelajari cara memberikan peran.

    Aktifkan API

Peran yang diperlukan

Untuk mendapatkan izin yang Anda perlukan untuk mengelola produk data, minta administrator untuk memberi Anda peran IAM berikut pada project:

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

Peran bawaan ini berisi izin yang diperlukan untuk mengelola produk data. Untuk melihat izin yang benar-benar diperlukan, perluas bagian Izin yang diperlukan:

Izin yang diperlukan

Izin berikut diperlukan untuk mengelola produk data:

  • Edit jenis aspek sistem overview: dataplex.entryGroups.useOverviewAspect
  • Edit jenis aspek sistem refresh cadence: dataplex.entryGroups.useRefreshCadenceAspect
  • Menyetujui permintaan akses untuk produk data: dataplex.dataProducts.approve

Anda mungkin juga bisa mendapatkan izin ini dengan peran khusus atau peran bawaan lainnya.

Kontrol akses untuk model BigQuery

Akses ke model BigQuery dalam produk data dikelola melalui kondisi IAM yang diterapkan ke kebijakan IAM set data induk.

Jika Anda menghapus lalu membuat ulang model BigQuery menggunakan nama yang sama, Knowledge Catalog akan memulihkan izin yang sebelumnya diberikan kepada Akun Layanan atau Grup Google melalui produk data.

Menetapkan izin untuk membuat produk data dapat ditemukan

Agar calon konsumen dapat menelusuri, melihat, dan meminta akses ke produk data, pemilik produk data harus memastikan produk tersebut dapat ditemukan dengan memberikan peran IAM yang sesuai pada resource produk data:

  • Menelusuri, melihat, dan meminta akses ke produk data: Konsumen Produk Data Dataplex (dataplex.dataProductsConsumer)

  • Melihat definisi dan metadata produk data (akses hanya baca): Pelihat Produk Data Dataplex (dataplex.dataProductsViewer)

Mengelola permintaan akses produk data

Saat konsumen produk data meminta akses, pemilik produk data akan menerima notifikasi email. Pemilik dapat meninjau, menyetujui, atau menolak permintaan ini menggunakan konsol Google Cloud atau API.

Konsol

Meninjau permintaan akses untuk produk data tertentu

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang permintaan aksesnya ingin Anda tinjau.

  3. Klik tab Pengelolaan permintaan akses.

  4. Pilih pemohon yang permintaannya ingin Anda tinjau.

  5. Klik Tindakan , lalu klik Setujui atau Tolak.

  6. Klik Simpan.

Meninjau permintaan akses di beberapa produk data

  1. Di konsol Google Cloud , buka halaman Alur kerja tata kelola Knowledge Catalog.

    Buka Alur kerja tata kelola

  2. Klik tab Persetujuan Tertunda.

  3. Opsional: Filter daftar menurut nama produk data tertentu untuk mengisolasi permintaannya.

  4. Pilih permintaan target, lalu klik Setujui atau Tolak.

  5. Klik Simpan.

Perilaku pasca-persetujuan

  • Permintaan pengguna: Konsumen yang meminta akses untuk identitas pengguna mereka akan otomatis ditambahkan sebagai anggota ke Grup Google yang dipetakan ke grup akses.

  • Permintaan akun layanan: Konsumen yang meminta akses untuk akun layanan diberi izin untuk meniru identitas akun layanan produsen data yang dipetakan ke grup akses.

Setelah diproses, status permintaan akan diperbarui secara otomatis dan entri akan dipindahkan ke tab Log persetujuan.

REST

Mencantumkan semua permintaan akses yang menunggu persetujuan

Untuk mencantumkan semua permintaan akses yang menunggu peninjauan Anda dalam project dan lokasi tertentu, kirim permintaan GET menggunakan metode kumpulan data kustom :listReviewable:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/changeRequests:listReviewable"

Ganti kode berikut:

  • PROJECT_ID: ID Google Cloud project Anda

  • LOCATION: region tempat produk data berada (misalnya, us-central1)

Menyetujui permintaan akses

Pemilik produk data dengan izin dataplex.dataProducts.approve dapat menyetujui permintaan yang tertunda dengan mengirimkan permintaan POST ke metode kustom :approve:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/changeRequests/CHANGE_REQUEST_ID:approve"

Ganti kode berikut:

  • PROJECT_ID: ID Google Cloud project Anda

  • LOCATION: region tempat produk data berada (misalnya, us-central1)

  • CHANGE_REQUEST_ID: ID unik permintaan akses yang ingin Anda setujui

Tidak seperti persetujuan yang didorong konsol, menyetujui permintaan perubahan menggunakan REST API tidak secara otomatis mengubah keanggotaan Grup Google atau mengonfigurasi peniruan identitas token akun layanan. Anda harus menyelesaikan langkah-langkah pengelolaan akses hilir ini secara manual:

  • Untuk permintaan akses identitas pengguna: Tambahkan konsumen produk data ke Grup Google yang dipetakan. Untuk mengetahui informasi selengkapnya, lihat Menambahkan keanggotaan ke Grup Google.

  • Untuk permintaan akses akun layanan: Berikan peran IAM Service Account Token Creator (roles/iam.serviceAccountTokenCreator) ke akun layanan konsumen produk data di resource dengan menjalankan perintah berikut:

    gcloud iam service-accounts add-iam-policy-binding PRODUCER_SERVICE_ACCOUNT \
      --member="serviceAccount:CONSUMER_SERVICE_ACCOUNT" \
      --role="roles/iam.serviceAccountTokenCreator"
    

    Ganti kode berikut:

    • PRODUCER_SERVICE_ACCOUNT: alamat email yang sepenuhnya memenuhi syarat dari akun layanan yang dipetakan ke grup akses produk data

    • CONSUMER_SERVICE_ACCOUNT: alamat email yang sepenuhnya memenuhi syarat dari akun layanan milik konsumen yang meminta akses

Menolak permintaan akses

Pemilik produk data dengan izin dataplex.dataProducts.approve dapat menolak permintaan yang tertunda dengan mengirim permintaan POST ke metode kustom :reject bersama dengan payload justifikasi:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{
  "comment": "REJECTION_REASON"
}' \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/changeRequests/CHANGE_REQUEST_ID:reject"

Ganti kode berikut:

  • PROJECT_ID: ID Google Cloud project Anda

  • LOCATION: region tempat produk data berada (misalnya, us-central1)

  • CHANGE_REQUEST_ID: ID unik permintaan akses yang ingin Anda tolak

Memperbarui produk data

Anda dapat memperbarui detail dasar (misalnya, nama produk data, deskripsi, detail pemilik), aset, grup akses, izin, kontrak, aspek, dan dokumentasi tambahan untuk produk data yang ada.

Memperbarui detail dasar produk data

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang ingin Anda perbarui.

  3. Klik Edit.

  4. Perbarui Nama produk data, Ikon produk data, Deskripsi, Alamat email pemilik produk data, Alamat email pemberi persetujuan produk data, dan Label sesuai kebutuhan.

  5. Klik Simpan.

C#

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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 GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for UpdateDataProduct</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 UpdateDataProductRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        UpdateDataProductRequest request = new UpdateDataProductRequest
        {
            DataProduct = new DataProduct(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataProduct, OperationMetadata> response = dataProductServiceClient.UpdateDataProduct(request);

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

Go

Go

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


//go:build examples

package main

import (
	"context"

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

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

	req := &dataplexpb.UpdateDataProductRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateDataProductRequest.
	}
	op, err := c.UpdateDataProduct(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 Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Java API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

import com.google.cloud.dataplex.v1.DataProduct;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataProductRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataProduct {

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

  public static void syncUpdateDataProduct() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataProductRequest request =
          UpdateDataProductRequest.newBuilder()
              .setDataProduct(DataProduct.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataProduct response = dataProductServiceClient.updateDataProductAsync(request).get();
    }
  }
}

Node.js

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The data product to update.
 *  The data product's `name` field is used to identify the data product to
 *  update.
 */
// const dataProduct = {}
/**
 *  Optional. The list of fields to update.
 *  If this is empty or not set, then all the fields will be updated.
 */
// const updateMask = {}
/**
 *  Optional. Validates the request without actually updating the data product.
 *  Default: false.
 */
// const validateOnly = true

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

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

async function callUpdateDataProduct() {
  // Construct request
  const request = {
    dataProduct,
  };

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

callUpdateDataProduct();

Python

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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_data_product():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

    # Initialize request argument(s)
    data_product = dataplex_v1.DataProduct()
    data_product.display_name = "display_name_value"
    data_product.owner_emails = ["owner_emails_value1", "owner_emails_value2"]

    request = dataplex_v1.UpdateDataProductRequest(
        data_product=data_product,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)

REST

Untuk memperbarui detail dasar produk data, gunakan metode dataProducts.patch.

Misalnya, untuk memperbarui deskripsi produk data, kirim permintaan PATCH berikut:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"description": "NEW_DESCRIPTION"}' \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/ LOCATION/dataProducts/DATA_PRODUCT_ID?update_mask="description"

Ganti kode berikut:

  • NEW_DESCRIPTION: deskripsi baru untuk produk data
  • PROJECT_ID: ID project Google Cloud Anda
  • LOCATION: region tempat produk data berada
  • DATA_PRODUCT_ID: ID produk data Anda

Memperbarui aset produk data

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang asetnya ingin Anda perbarui.

  3. Klik tab Aset.

  4. Untuk menambahkan aset baru, ikuti langkah-langkah berikut:

    1. Klik +Add.

    2. Telusuri dan pilih aset yang ingin Anda tambahkan ke produk data. Aset yang Anda pilih harus berada di region yang sama dengan produk data.

      Jika memiliki izin yang diperlukan, Anda dapat melihat metadata aset dengan mengklik aset.

    3. Untuk menyaring hasil penelusuran, gunakan Filter.

    4. Setelah Anda memilih aset, klik Tambahkan.

  5. Untuk menghapus aset dari produk data, ikuti langkah-langkah berikut:

    1. Untuk aset yang ingin Anda hapus, klik > Hapus.

    2. Untuk mengonfirmasi tindakan, klik Hapus.

C#

Menambahkan aset data baru ke produk data

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
    using Google.Cloud.Dataplex.V1;
    using Google.LongRunning;

    public sealed partial class GeneratedDataProductServiceClientSnippets
    {
        /// <summary>Snippet for CreateDataAsset</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 CreateDataAssetRequestObject()
        {
            // Create client
            DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
            // Initialize request argument(s)
            CreateDataAssetRequest request = new CreateDataAssetRequest
            {
                ParentAsDataProductName = DataProductName.FromProjectLocationDataProduct("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]"),
                DataAssetId = "",
                DataAsset = new DataAsset(),
                ValidateOnly = false,
            };
            // Make the request
            Operation<DataAsset, OperationMetadata> response = dataProductServiceClient.CreateDataAsset(request);

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

Menghapus aset data dari produk data

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
    using Google.Cloud.Dataplex.V1;
    using Google.LongRunning;
    using Google.Protobuf.WellKnownTypes;

    public sealed partial class GeneratedDataProductServiceClientSnippets
    {
        /// <summary>Snippet for DeleteDataAsset</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 DeleteDataAssetRequestObject()
        {
            // Create client
            DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
            // Initialize request argument(s)
            DeleteDataAssetRequest request = new DeleteDataAssetRequest
            {
                DataAssetName = DataAssetName.FromProjectLocationDataProductDataAsset("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]", "[DATA_ASSET]"),
                Etag = "",
                ValidateOnly = false,
            };
            // Make the request
            Operation<Empty, OperationMetadata> response = dataProductServiceClient.DeleteDataAsset(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 = dataProductServiceClient.PollOnceDeleteDataAsset(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

Menambahkan aset data baru ke produk data

Go

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go_gapic. DO NOT EDIT.


//go:build examples

package main

import (
	"context"

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

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

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

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

Menghapus aset data dari produk data

Go

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go_gapic. DO NOT EDIT.


//go:build examples

package main

import (
	"context"

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

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

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

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

Java

Menambahkan aset data baru ke produk data

Java

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataplex.v1.samples;

import com.google.cloud.dataplex.v1.CreateDataAssetRequest;
import com.google.cloud.dataplex.v1.DataAsset;
import com.google.cloud.dataplex.v1.DataProductName;
import com.google.cloud.dataplex.v1.DataProductServiceClient;

public class SyncCreateDataAsset {

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

  public static void syncCreateDataAsset() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      CreateDataAssetRequest request =
          CreateDataAssetRequest.newBuilder()
              .setParent(DataProductName.of("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]").toString())
              .setDataAssetId("dataAssetId2108984609")
              .setDataAsset(DataAsset.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataAsset response = dataProductServiceClient.createDataAssetAsync(request).get();
    }
  }
}

Menghapus aset data dari produk data

Java

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataplex.v1.samples;

import com.google.cloud.dataplex.v1.DataAssetName;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.DeleteDataAssetRequest;
import com.google.protobuf.Empty;

public class SyncDeleteDataAsset {

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

  public static void syncDeleteDataAsset() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      DeleteDataAssetRequest request =
          DeleteDataAssetRequest.newBuilder()
              .setName(
                  DataAssetName.of("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]", "[DATA_ASSET]")
                      .toString())
              .setEtag("etag3123477")
              .setValidateOnly(true)
              .build();
      dataProductServiceClient.deleteDataAssetAsync(request).get();
    }
  }
}

Node.js

Menambahkan aset data baru ke produk data

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(parent, dataAsset) {
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource where this data asset will be created.
   *  Format:
   *  projects/{project_id_or_number}/locations/{location_id}/dataProducts/{data_product_id}
   */
  // const parent = 'abc123'
  /**
   *  Optional. The ID of the data asset to create.
   *  The ID must conform to RFC-1034 and contain only lower-case letters (a-z),
   *  numbers (0-9), or hyphens, with the first character a letter, the last a
   *  letter or a number, and a 63 character maximum. Characters outside of
   *  ASCII are not permitted.
   *  Valid format regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`
   *  If not provided, a system generated ID will be used.
   */
  // const dataAssetId = 'abc123'
  /**
   *  Required. The data asset to create.
   */
  // const dataAsset = {}
  /**
   *  Optional. Validates the request without actually creating the data asset.
   *  Defaults to false.
   */
  // const validateOnly = true

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

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

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

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

  callCreateDataAsset();
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));

Menghapus aset data dari produk data

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(name) {
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the data asset to delete.
   *  Format:
   *  projects/{project_id_or_number}/locations/{location_id}/dataProducts/{data_product_id}/dataAssets/{data_asset_id}
   */
  // const name = 'abc123'
  /**
   *  Optional. The etag of the data asset.
   *  If this is provided, it must match the server's etag.
   *  If the etag is provided and does not match the server-computed etag,
   *  the request must fail with a ABORTED error code.
   */
  // const etag = 'abc123'
  /**
   *  Optional. Validates the request without actually deleting the data asset.
   *  Defaults to false.
   */
  // const validateOnly = true

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

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

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

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

  callDeleteDataAsset();
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));

Python

Menambahkan aset data baru ke produk data

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for CreateDataAsset
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
#   python3 -m pip install google-cloud-dataplex


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

    # Initialize request argument(s)
    data_asset = dataplex_v1.DataAsset()
    data_asset.resource = "resource_value"

    request = dataplex_v1.CreateDataAssetRequest(
        parent="parent_value",
        data_asset=data_asset,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)


Menghapus aset data dari produk data

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for DeleteDataAsset
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
#   python3 -m pip install google-cloud-dataplex


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

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

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

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

    response = operation.result()

    # Handle the response
    print(response)


REST

Untuk menambahkan aset data baru ke produk data, gunakan metode dataAssets.create. Untuk contoh kode, lihat Opsional: Tambahkan aset.

Untuk menghapus aset data dari produk data, gunakan metode dataAssets.delete. Misalnya, kirim permintaan DELETE berikut:

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataProducts/DATA_PRODUCT_ID/dataAssets/DATA_ASSET_ID"

Ganti kode berikut:

  • PROJECT_ID: ID project Google Cloud Anda
  • LOCATION: region tempat Anda ingin membuat produk data
  • DATA_PRODUCT_ID: ID unik untuk produk data Anda
  • DATA_ASSET_ID: ID aset data yang ingin dihapus dari produk data

Memperbarui grup akses dan izin aset

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang ingin Anda perbarui grup akses dan izinnya.

  3. Klik tab Grup akses & izin.

  4. Untuk memperbarui grup akses, ikuti langkah-langkah berikut:

    1. Klik Edit.

    2. Perbarui nama, deskripsi, dan ID grup akses sesuai kebutuhan.

    3. Untuk menambahkan grup akses baru, klik Tambahkan grup akses dan ikuti langkah-langkah berikut:

      1. Di kolom Nama grup akses, masukkan nama untuk grup akses baru. Contoh, Analyst.

      2. Di kolom Deskripsi grup akses, masukkan deskripsi untuk grup akses.

      3. Di kolom ID grup akses, masukkan alamat email Grup Google atau akun layanan atau keduanya yang ingin Anda tetapkan ke grup akses ini:

        • Google Grup: Konsumen produk data yang meminta akses untuk diri mereka sendiri akan ditambahkan sebagai anggota ke Google Grup yang dipetakan.

        • Akun layanan: Konsumen produk data yang meminta akses untuk akun layanan mereka diberi peran IAM Service Account Token Creator (roles/iam.serviceAccountTokenCreator) untuk meniru akun layanan produsen data yang dipetakan ke grup akses.

    4. Klik Tambahkan.

  5. Untuk menghapus grup akses, ikuti langkah-langkah berikut:

    1. Untuk grup akses yang ingin Anda hapus, klik > Hapus.

    2. Untuk mengonfirmasi tindakan, klik Hapus.

  6. Jika tidak ada grup akses yang dikonfigurasi untuk produk data yang dipilih, Anda dapat menambahkan grup akses baru dengan mengklik Tambahkan grup akses.

  7. Untuk memperbarui izin aset, ikuti langkah-langkah berikut:

    1. Untuk aset yang izinnya ingin Anda perbarui, klik > Izin.

    2. Perbarui grup akses dan peran IAM yang diperlukan.

    3. Klik Configure.

C#

Memperbarui grup akses

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
    using Google.Cloud.Dataplex.V1;
    using Google.LongRunning;
    using Google.Protobuf.WellKnownTypes;

    public sealed partial class GeneratedDataProductServiceClientSnippets
    {
        /// <summary>Snippet for UpdateDataProduct</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 UpdateDataProductRequestObject()
        {
            // Create client
            DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
            // Initialize request argument(s)
            UpdateDataProductRequest request = new UpdateDataProductRequest
            {
                DataProduct = new DataProduct(),
                UpdateMask = new FieldMask(),
                ValidateOnly = false,
            };
            // Make the request
            Operation<DataProduct, OperationMetadata> response = dataProductServiceClient.UpdateDataProduct(request);

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

Memperbarui izin aset

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
    using Google.Cloud.Dataplex.V1;
    using Google.LongRunning;
    using Google.Protobuf.WellKnownTypes;

    public sealed partial class GeneratedDataProductServiceClientSnippets
    {
        /// <summary>Snippet for UpdateDataAsset</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 UpdateDataAssetRequestObject()
        {
            // Create client
            DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
            // Initialize request argument(s)
            UpdateDataAssetRequest request = new UpdateDataAssetRequest
            {
                DataAsset = new DataAsset(),
                UpdateMask = new FieldMask(),
                ValidateOnly = false,
            };
            // Make the request
            Operation<DataAsset, OperationMetadata> response = dataProductServiceClient.UpdateDataAsset(request);

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

Go

Memperbarui grup akses

Java

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataplex.v1.samples;

import com.google.cloud.dataplex.v1.DataProduct;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataProductRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataProduct {

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

  public static void syncUpdateDataProduct() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataProductRequest request =
          UpdateDataProductRequest.newBuilder()
              .setDataProduct(DataProduct.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataProduct response = dataProductServiceClient.updateDataProductAsync(request).get();
    }
  }
}

Memperbarui izin aset

Go

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go_gapic. DO NOT EDIT.


//go:build examples

package main

import (
	"context"

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

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

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

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

Java

Memperbarui grup akses

Java

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataplex.v1.samples;

import com.google.cloud.dataplex.v1.DataProduct;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataProductRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataProduct {

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

  public static void syncUpdateDataProduct() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataProductRequest request =
          UpdateDataProductRequest.newBuilder()
              .setDataProduct(DataProduct.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataProduct response = dataProductServiceClient.updateDataProductAsync(request).get();
    }
  }
}

Memperbarui izin aset

Java

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataplex.v1.samples;

import com.google.cloud.dataplex.v1.DataAsset;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataAssetRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataAsset {

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

  public static void syncUpdateDataAsset() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataAssetRequest request =
          UpdateDataAssetRequest.newBuilder()
              .setDataAsset(DataAsset.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataAsset response = dataProductServiceClient.updateDataAssetAsync(request).get();
    }
  }
}

Node.js

Memperbarui grup akses

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(dataProduct) {
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The data product to update.
   *  The data product's `name` field is used to identify the data product to
   *  update.
   */
  // const dataProduct = {}
  /**
   *  Optional. The list of fields to update.
   *  If this is empty or not set, then all the fields will be updated.
   */
  // const updateMask = {}
  /**
   *  Optional. Validates the request without actually updating the data product.
   *  Default: false.
   */
  // const validateOnly = true

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

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

  async function callUpdateDataProduct() {
    // Construct request
    const request = {
      dataProduct,
    };

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

  callUpdateDataProduct();
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));

Memperbarui izin aset

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(dataAsset) {
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The data asset to update.
   *  The data asset's `name` field is used to identify the data asset to update.
   */
  // const dataAsset = {}
  /**
   *  Optional. The list of fields to update.
   *  If this is empty or not set, then all the fields will be updated.
   */
  // const updateMask = {}
  /**
   *  Optional. Validates the request without actually updating the data asset.
   *  Defaults to false.
   */
  // const validateOnly = true

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

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

  async function callUpdateDataAsset() {
    // Construct request
    const request = {
      dataAsset,
    };

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

  callUpdateDataAsset();
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));

Python

Memperbarui grup akses

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for UpdateDataProduct
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
#   python3 -m pip install google-cloud-dataplex


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

    # Initialize request argument(s)
    data_product = dataplex_v1.DataProduct()
    data_product.display_name = "display_name_value"
    data_product.owner_emails = ["owner_emails_value1", "owner_emails_value2"]

    request = dataplex_v1.UpdateDataProductRequest(
        data_product=data_product,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)


Memperbarui izin aset

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for UpdateDataAsset
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
#   python3 -m pip install google-cloud-dataplex


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

    # Initialize request argument(s)
    data_asset = dataplex_v1.DataAsset()
    data_asset.resource = "resource_value"

    request = dataplex_v1.UpdateDataAssetRequest(
        data_asset=data_asset,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)


REST

Untuk memperbarui grup akses yang terkait dengan produk data, gunakan metode dataProducts.patch. Untuk contoh kode, lihat Mengonfigurasi grup akses.

Untuk memperbarui izin aset, gunakan metode dataAssets.patch. Untuk contoh kode, lihat Mengonfigurasi izin aset.

Memperbarui kontrak produk data

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang kontraknya ingin Anda perbarui.

  3. Klik tab Kontrak.

  4. Untuk memperbarui kontrak yang ada, ikuti langkah-langkah berikut:

    1. Klik Edit.

    2. Perbarui kolom yang diperlukan.

    3. Klik Simpan.

  5. Jika tidak ada kontrak yang dilampirkan ke produk data yang dipilih, Anda dapat menambahkan kontrak dengan mengklik Tambahkan kontrak.

REST

Untuk memperbarui kontrak, gunakan metode entries.patch. Untuk contoh kode, lihat Menambahkan kontrak.

Memperbarui aspek produk data

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang aspeknya ingin Anda perbarui.

  3. Klik tab Aspek.

  4. Untuk memperbarui aspek, ikuti langkah-langkah berikut:

    1. Klik aspek yang ingin Anda perbarui.

    2. Klik Edit.

    3. Perbarui Jenis aspek, Negara, dan Wilayah sesuai kebutuhan.

    4. Klik Simpan.

  5. Untuk menambahkan aspek baru untuk produk data, ikuti langkah-langkah berikut:

    1. Klik + Tambahkan aspek.

    2. Di kolom Pilih jenis aspek, telusuri dan pilih jenis aspek dari daftar. Contoh, Geo context.

    3. Di kolom Negara, pilih negara tempat aset berada.

    4. Di kolom Region, pilih wilayah bisnis tempat aset berada.

    5. Klik Simpan.

  6. Untuk menghapus aspek, ikuti langkah-langkah berikut:

    1. Klik aspek yang ingin Anda hapus.

    2. Klik Delete.

    3. Untuk mengonfirmasi tindakan, klik Konfirmasi.

REST

Untuk memperbarui aspek apa pun pada entri produk data, gunakan metode entries.patch.

Memperbarui dokumentasi produk data

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang dokumentasinya ingin Anda perbarui.

  3. Klik tab Overview.

  4. Klik Edit di samping Dokumentasi.

  5. Perbarui panduan pengguna, contoh kueri, dan dokumentasi lainnya sesuai kebutuhan.

  6. Klik Simpan.

REST

Dokumentasi adalah bagian dari aspek overview. Untuk memperbarui dokumentasi produk data, gunakan metode entries.patch.

Menghapus produk data

Untuk menghapus produk data, Anda harus menghapus semua aset dari produk data terlebih dahulu.

Konsol

  1. Di konsol Google Cloud , buka halaman Produk data Knowledge Catalog.

    Buka Produk data

  2. Klik produk data yang ingin Anda hapus.

  3. Klik tab Aset.

  4. Untuk setiap aset yang tercantum, klik > Hapus. Konfirmasi tindakan dengan mengklik Hapus.

  5. Setelah menghapus semua aset, hapus produk data dengan mengklik Hapus.

  6. Pada dialog konfirmasi, masukkan delete, lalu klik Hapus.

C#

C#

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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 GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for DeleteDataProduct</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 DeleteDataProductRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        DeleteDataProductRequest request = new DeleteDataProductRequest
        {
            DataProductName = DataProductName.FromProjectLocationDataProduct("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]"),
            Etag = "",
            ValidateOnly = false,
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = dataProductServiceClient.DeleteDataProduct(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 = dataProductServiceClient.PollOnceDeleteDataProduct(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 Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Go API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


//go:build examples

package main

import (
	"context"

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

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

	req := &dataplexpb.DeleteDataProductRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteDataProductRequest.
	}
	op, err := c.DeleteDataProduct(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 Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Java API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

import com.google.cloud.dataplex.v1.DataProductName;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.DeleteDataProductRequest;
import com.google.protobuf.Empty;

public class SyncDeleteDataProduct {

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

  public static void syncDeleteDataProduct() 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 (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      DeleteDataProductRequest request =
          DeleteDataProductRequest.newBuilder()
              .setName(DataProductName.of("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]").toString())
              .setEtag("etag3123477")
              .setValidateOnly(true)
              .build();
      dataProductServiceClient.deleteDataProductAsync(request).get();
    }
  }
}

Node.js

Node.js

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The name of the data product to delete.
 *  Format:
 *  projects/{project_id_or_number}/locations/{location_id}/dataProducts/{data_product_id}
 */
// const name = 'abc123'
/**
 *  Optional. The etag of the data product.
 *  If an etag is provided and does not match the current etag of the data
 *  product, then the deletion will be blocked and an ABORTED error will be
 *  returned.
 */
// const etag = 'abc123'
/**
 *  Optional. Validates the request without actually deleting the data product.
 *  Default: false.
 */
// const validateOnly = true

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

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

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

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

callDeleteDataProduct();

Python

Python

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

Untuk melakukan autentikasi ke Knowledge Catalog, 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_data_product():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

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

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

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

    response = operation.result()

    # Handle the response
    print(response)

REST

Untuk menghapus produk data, gunakan metode dataProducts.delete.

Misalnya, kirim permintaan DELETE berikut:

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/ LOCATION/dataProducts/DATA_PRODUCT_ID

Ganti kode berikut:

  • PROJECT_ID: ID project Google Cloud Anda
  • LOCATION: region tempat produk data berada
  • DATA_PRODUCT_ID: ID produk data yang ingin Anda hapus

Retensi data dan penghapusan project

Saat Anda menghapus Google Cloud project yang berisi produk data, resource terkait akan mengikuti siklus proses penghapusan Google Cloud standar, yang juga disebut sebagai penghapusan total. Untuk ringkasan mendetail tentang proses dan rentang waktu teknis yang mengatur perilaku ini, lihat Penghapusan data di Google Cloud.

Siklus proses resource selama penghapusan project

Siklus proses produk data dan aset data Anda dikelola dalam dua tahap utama setelah permintaan penghapusan proyek:

  • Penghapusan sementara (status Hidden): Segera setelah memulai penghapusan project, semua produk data dan aset data dalam project akan ditandai sebagai Hidden. Selama masa tenggang 30 hari ini, metadata akan dipertahankan, tetapi tidak dapat diakses lagi melalui API Dataplex atau konsol Google Cloud . Anda dapat memulihkan project dan resource-nya kapan saja selama periode ini.

  • Penghapusan permanen (status Purged): Setelah masa tenggang 30 hari berakhir, project dan semua metadata Knowledge Catalog-nya akan dihapus secara permanen. Knowledge Catalog menggunakan kebijakan penghapusan baris internal untuk menghapus catatan ini secara terverifikasi dari penyimpanan.

Perilaku kebijakan IAM pada resource lintas project

Ada perbedaan operasional yang penting antara metadata Knowledge Catalog dan kebijakan IAM yang diterapkan pada data fisik pokok Anda (seperti set data BigQuery atau bucket Cloud Storage).

Meskipun metadata Knowledge Catalog dalam project dihapus secara otomatis, semua binding IAM yang diterapkan ke resource data yang berada di project lain (Project B) tidak akan otomatis dicabut saat project pemilik produk data (Project A) dihapus.

  • Binding tanpa induk: Karena resource fisik dalam project target tetap aktif, sistem IAM tidak otomatis menghapus ID utama yang terkait dengan project yang dihapus.

  • Mencegah izin zombie: Untuk memastikan penonaktifan akses data yang lengkap, hapus aset data secara manual dari produk data Anda, atau hapus secara eksplisit binding IAM terkait dari resource lintas project Anda, sebelum Anda memulai penghapusan project.

Pemulihan project (Batal Hapus)

Jika Anda memulihkan project yang dihapus dalam masa tenggang 30 hari, Knowledge Catalog akan mencoba memulihkan resource Anda dan visibilitasnya dalam katalog. Untuk aset lintas project, karena binding IAM pokok tidak otomatis dicabut selama proses penghapusan, akses data biasanya segera dilanjutkan untuk project yang dipulihkan.

Langkah berikutnya