Knowledge Catalog에서 리소스 검색

이 문서에서는 Knowledge Catalog에서 데이터 애셋을 검색하는 방법을 설명합니다.

시작하기 전에

검색을 수행하기 전에 필요한 역할이 부여되었고 필요한 API가 사용 설정되어 있는지 확인합니다.

필요한 역할

Knowledge Catalog에서 항목을 검색하고 검색 결과에 액세스하는 데 필요한 권한을 얻으려면 관리자에게 다음 IAM 역할을 부여해 달라고 요청하세요.

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.

애셋 수준 권한

검색 결과는 선택한 프로젝트와 관계없이 액세스 수준으로 범위가 지정됩니다. Knowledge Catalog에서 애셋을 찾으려면 기본 소스 시스템에서 해당 리소스에 대한 적절한 읽기 권한이 있어야 합니다.

예를 들어 BigQuery 테이블을 찾으려면 roles/bigquery.metadataViewer 역할이 필요하고 Cloud SQL 인스턴스를 찾으려면 이에 상응하는 Cloud SQL 권한이 필요합니다. 자세한 내용은 검색 범위를 참고하세요.

API 사용 설정

Dataplex API를 사용 설정합니다.

API 사용 설정에 필요한 역할

API를 사용 설정하려면 serviceusage.services.enable 권한이 필요합니다. 프로젝트를 만든 경우 소유자 역할 (roles/owner)을 통해 이 권한이 이미 있을 수 있습니다. 그렇지 않으면 서비스 사용량 관리자 역할 (roles/serviceusage.serviceUsageAdmin)을 통해 이 권한을 얻을 수 있습니다. 역할을 부여하는 방법 알아보기

API 사용 설정하기

리소스 검색

콘솔

리소스를 검색하려면 다음 단계를 따르세요.

  1. Google Cloud 콘솔에서 Knowledge Catalog 검색 페이지로 이동합니다.

    검색 페이지로 이동

  2. 자연어 검색 사용해 보기 버튼 프롬프트가 표시되면 클릭합니다. 기본적으로 자연어 검색이 선택되어 있습니다.

  3. 자연어로 프로젝트 전반에서 리소스 찾기 필드에 검색어를 입력한 후 Enter 키를 누릅니다.

  4. 검색을 미세 조정하려면 필터를 클릭합니다.

    • 여러 섹션의 필터는 AND 논리 연산자를 사용하여 평가됩니다.
    • 단일 섹션 내의 여러 필터는 OR 논리 연산자를 사용하여 평가됩니다.

    사용할 수 있는 필터는 다음과 같습니다.

    • 범위: 조직(기본값), 현재 프로젝트 또는 별표표시된 리소스만 검색합니다. 자세한 내용은 검색 범위를 참고하세요.
    • 시스템: 리소스가 속한 Google Cloud 서비스입니다(예: BigQuery). Knowledge Catalog 시스템에는 항목 그룹이 포함되어 있습니다.
    • 프로젝트: 검색할 프로젝트입니다.
    • 유형: BigQuery 연결, Cloud Storage 버킷 또는 데이터베이스와 같은 리소스 유형입니다. 리소스 유형에 따라 연결 유형이나 SQL 언어와 같은 하위 유형별로 필터링할 수도 있습니다.
    • 위치 선택: 검색할 위치입니다.
    • 데이터 세트 선택: 검색 결과가 선택한 BigQuery 데이터 세트에 속하는 BigQuery 리소스로 제한됩니다. 필터링할 항목 입력 필드에 데이터 세트의 이름을 입력합니다.
    • 관점 유형: 검색 중인 리소스와 연결된 Knowledge Catalog 관점 유형입니다. 관점 값별로 필터링하려면 관점 유형 값 필터링을 클릭한 후 값을 선택합니다.
  5. 검색된 리소스에 대한 자세한 정보를 보려면 검색 결과에서 리소스 이름을 클릭하여 항목 세부정보 페이지를 엽니다.

Google Cloud CLI

리소스를 검색하려면 gcloud dataplex entries search 명령어를 사용합니다.

gcloud dataplex entries search 'foo' \
  --project=PROJECT_ID \
  --semantic-search

PROJECT_ID를 Google Cloud 프로젝트의 ID로 바꿉니다.

C#

C#

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용C# 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog C# API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

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

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for SearchEntries</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 SearchEntriesRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        SearchEntriesRequest request = new SearchEntriesRequest
        {
            LocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Query = "",
            OrderBy = "",
            Scope = "",
            SemanticSearch = false,
        };
        // Make the request
        PagedEnumerable<SearchEntriesResponse, SearchEntriesResult> response = catalogServiceClient.SearchEntries(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (SearchEntriesResult 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 (SearchEntriesResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (SearchEntriesResult 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<SearchEntriesResult> 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 (SearchEntriesResult item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Go

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Go 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Go API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


//go:build examples

package main

import (
	"context"

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

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

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

자바

Java

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Java API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.LocationName;
import com.google.cloud.dataplex.v1.SearchEntriesRequest;
import com.google.cloud.dataplex.v1.SearchEntriesResult;

public class SyncSearchEntries {

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

  public static void syncSearchEntries() 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()) {
      SearchEntriesRequest request =
          SearchEntriesRequest.newBuilder()
              .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setQuery("query107944136")
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setOrderBy("orderBy-1207110587")
              .setScope("scope109264468")
              .setSemanticSearch(true)
              .build();
      for (SearchEntriesResult element : catalogServiceClient.searchEntries(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Node.js

Node.js

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Node.js API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The project to which the request should be attributed in the
 *  following form: `projects/{project}/locations/global`.
 */
// const name = 'abc123'
/**
 *  Required. The query against which entries in scope should be matched.
 *  The query syntax is defined in Search syntax for Dataplex Universal
 *  Catalog (https://cloud.google.com/dataplex/docs/search-syntax).
 */
// const query = 'abc123'
/**
 *  Optional. Number of results in the search page. If <=0, then defaults
 *  to 10. Max limit for page_size is 1000. Throws an invalid argument for
 *  page_size > 1000.
 */
// const pageSize = 1234
/**
 *  Optional. Page token received from a previous `SearchEntries` call. Provide
 *  this to retrieve the subsequent page.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Specifies the ordering of results.
 *  Supported values are:
 *  * `relevance`
 *  * `last_modified_timestamp`
 *  * `last_modified_timestamp asc`
 */
// const orderBy = 'abc123'
/**
 *  Optional. The scope under which the search should be operating. It must
 *  either be `organizations/<org_id>` or `projects/<project_ref>`. If it is
 *  unspecified, it defaults to the organization where the project provided in
 *  `name` is located.
 */
// const scope = 'abc123'
/**
 *  Optional. Specifies whether the search should understand the meaning and
 *  intent behind the query, rather than just matching keywords.
 */
// const semanticSearch = true

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

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

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

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

callSearchEntries();

PHP

PHP

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용PHP 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog PHP API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dataplex\V1\Client\CatalogServiceClient;
use Google\Cloud\Dataplex\V1\SearchEntriesRequest;
use Google\Cloud\Dataplex\V1\SearchEntriesResult;

/**
 * Searches for Entries matching the given query and scope.
 *
 * @param string $formattedName The project to which the request should be attributed in the
 *                              following form: `projects/{project}/locations/global`. Please see
 *                              {@see CatalogServiceClient::locationName()} for help formatting this field.
 * @param string $query         The query against which entries in scope should be matched.
 *                              The query syntax is defined in [Search syntax for Dataplex Universal
 *                              Catalog](https://cloud.google.com/dataplex/docs/search-syntax).
 */
function search_entries_sample(string $formattedName, string $query): void
{
    // Create a client.
    $catalogServiceClient = new CatalogServiceClient();

    // Prepare the request message.
    $request = (new SearchEntriesRequest())
        ->setName($formattedName)
        ->setQuery($query);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $catalogServiceClient->searchEntries($request);

        /** @var SearchEntriesResult $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = CatalogServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $query = '[QUERY]';

    search_entries_sample($formattedName, $query);
}

Python

Python

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Python 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Python API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

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


def sample_search_entries():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.SearchEntriesRequest(
        name="name_value",
        query="query_value",
    )

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

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

Ruby

Ruby

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Ruby 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Ruby API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

require "google/cloud/dataplex/v1"

##
# Snippet for the search_entries 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#search_entries.
#
def search_entries
  # 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::SearchEntriesRequest.new

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

REST

리소스를 검색하려면 SemanticSearch 매개변수가 true로 설정된 searchEntries 메서드를 사용합니다.

POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION:searchEntries?query=foo&semanticSearch=true

다음을 바꿉니다.

  • PROJECT_ID: Google Cloud 프로젝트 ID
  • LOCATION: 프로젝트가 있는 리전 (예: us-central1)

검색에서 반환된 애셋의 세부정보 보기

콘솔

Knowledge Catalog 검색을 사용하여 애셋의 세부정보를 확인합니다.

  1. Knowledge Catalog에서 애셋을 검색합니다.

  2. 검색 결과에서 세부정보를 보려는 애셋을 클릭합니다.

    항목 세부정보 페이지가 열립니다. 이 페이지에는 다음 섹션이 포함되어 있습니다.

    • 항목 세부정보: 항목 유형, 시스템, 플랫폼, 정규화된 이름, 생성 시간, 마지막 수정 시간, 설명, 관리자와 같은 정보가 포함됩니다.
    • 개요: 항목 개요입니다(제공되는 경우).
    • 관점: 항목에 정의된 필수 관점과 선택적 관점입니다. 자세한 내용은 관점 카테고리를 참조하세요.

gcloud

gcloud dataplex entries lookup 명령:

gcloud dataplex entries lookup ENTRY_ID \
  --entry-group=ENTRY_GROUP_ID \
  --location=LOCATION \
  --project=PROJECT_ID

다음을 바꿉니다.

  • ENTRY_ID: 항목의 ID
  • ENTRY_GROUP_ID: 항목 그룹의 ID
  • LOCATION: 프로젝트가 있는 리전
  • PROJECT_ID: Google Cloud 프로젝트 ID

C#

C#

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용C# 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog C# API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for LookupEntry</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 LookupEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        LookupEntryRequest request = new LookupEntryRequest
        {
            Name = "",
            View = EntryView.Unspecified,
            AspectTypes = { "", },
            Paths = { "", },
            EntryAsEntryName = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]"),
        };
        // Make the request
        Entry response = catalogServiceClient.LookupEntry(request);
    }
}

Go

Go

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Go 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Go API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


//go:build examples

package main

import (
	"context"

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

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

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

자바

Java

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Java API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.EntryName;
import com.google.cloud.dataplex.v1.EntryView;
import com.google.cloud.dataplex.v1.LookupEntryRequest;
import java.util.ArrayList;

public class SyncLookupEntry {

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

  public static void syncLookupEntry() 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()) {
      LookupEntryRequest request =
          LookupEntryRequest.newBuilder()
              .setName("name3373707")
              .setView(EntryView.forNumber(0))
              .addAllAspectTypes(new ArrayList<String>())
              .addAllPaths(new ArrayList<String>())
              .setEntry(
                  EntryName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]").toString())
              .build();
      Entry response = catalogServiceClient.lookupEntry(request);
    }
  }
}

Node.js

Node.js

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Node.js API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The project to which the request should be attributed in the
 *  following form: `projects/{project}/locations/{location}`.
 */
// const name = 'abc123'
/**
 *  Optional. View to control which parts of an entry the service should
 *  return.
 *  **Please check the limitations on returned aspects in the Entry view
 *  documentation. Amount of returned aspects depends on the selected Entry
 *  View.**
 */
// const view = {}
/**
 *  Optional. Limits the aspects returned to the provided aspect types.
 *  It only works for CUSTOM view.
 */
// const aspectTypes = ['abc','def']
/**
 *  Optional. Limits the aspects returned to those associated with the provided
 *  paths within the Entry. It only works for CUSTOM view.
 */
// const paths = ['abc','def']
/**
 *  Required. The resource name of the Entry:
 *  `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`.
 */
// const entry = 'abc123'

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

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

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

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

callLookupEntry();

PHP

PHP

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용PHP 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog PHP API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\CatalogServiceClient;
use Google\Cloud\Dataplex\V1\Entry;
use Google\Cloud\Dataplex\V1\LookupEntryRequest;

/**
 * Looks up an entry by name using the permission on the source system.
 *
 * @param string $name           The project to which the request should be attributed in the
 *                               following form: `projects/{project}/locations/{location}`.
 * @param string $formattedEntry The resource name of the Entry:
 *                               `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`. Please see
 *                               {@see CatalogServiceClient::entryName()} for help formatting this field.
 */
function lookup_entry_sample(string $name, string $formattedEntry): void
{
    // Create a client.
    $catalogServiceClient = new CatalogServiceClient();

    // Prepare the request message.
    $request = (new LookupEntryRequest())
        ->setName($name)
        ->setEntry($formattedEntry);

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $catalogServiceClient->lookupEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $formattedEntry = CatalogServiceClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );

    lookup_entry_sample($name, $formattedEntry);
}

Python

Python

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Python 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Python API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

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


def sample_lookup_entry():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.LookupEntryRequest(
        name="name_value",
        entry="entry_value",
    )

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

    # Handle the response
    print(response)

Ruby

Ruby

이 샘플을 사용해 보기 전에 Knowledge Catalog 빠른 시작: 클라이언트 라이브러리 사용Ruby 설정 안내를 따르세요. 자세한 내용은 Knowledge Catalog Ruby API 참고 문서를 참고하세요.

Knowledge Catalog에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

require "google/cloud/dataplex/v1"

##
# Snippet for the lookup_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#lookup_entry.
#
def lookup_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::LookupEntryRequest.new

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

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

REST

애셋의 세부정보를 보려면 lookupEntry 메서드를 사용합니다.

제한사항

검색에는 다음과 같은 제한사항이 있습니다.

  • 공개 리소스는 자연어 검색 범위에 포함되지 않습니다.
  • 항목 링크에 연결된 측면은 자연어 검색 범위에 포함되지 않습니다.

다음 단계