Cercare risorse in Knowledge Catalog

Questo documento fornisce istruzioni su come cercare asset di dati in Knowledge Catalog.

Prima di iniziare

Prima di eseguire la ricerca, assicurati di disporre dei ruoli richiesti e di aver abilitato l'API necessaria.

Ruoli obbligatori

Per ottenere le autorizzazioni necessarie per cercare voci e accedere ai risultati di ricerca in Knowledge Catalog, chiedi all'amministratore di concederti i seguenti ruoli IAM:

Per saperne di più sulla concessione dei ruoli, consulta Gestisci l'accesso a progetti, cartelle e organizzazioni.

Potresti anche riuscire a ottenere le autorizzazioni richieste tramite i ruoli personalizzati o altri ruoli predefiniti.

Autorizzazioni a livello di asset

I risultati di ricerca sono limitati al tuo livello di accesso, indipendentemente dal progetto selezionato. Per trovare un asset in Knowledge Catalog, devi disporre delle autorizzazioni di lettura appropriate per la risorsa nel sistema di origine sottostante.

Ad esempio, per trovare una tabella BigQuery è necessario il ruolo roles/bigquery.metadataViewer, mentre per trovare un'istanza Cloud SQL sono necessarie le autorizzazioni Cloud SQL equivalenti. Per maggiori dettagli, consulta Ambito di ricerca.

Abilita l'API

Abilitare l'API Dataplex.

Ruoli richiesti per abilitare le API

Per abilitare le API, devi disporre dell'autorizzazione serviceusage.services.enable. Se hai creato il progetto, probabilmente disponi già di questa autorizzazione tramite il ruolo Proprietario (roles/owner). In caso contrario, puoi ottenere questa autorizzazione tramite il ruolo Amministratore utilizzo dei servizi (roles/serviceusage.serviceUsageAdmin). Scopri come concedere i ruoli.

Abilitare l'API

Cerca risorse

Console

Per cercare risorse, segui questi passaggi:

  1. Nella console Google Cloud , vai alla pagina Ricerca di Knowledge Catalog.

    Vai a Cerca

  2. Se vedi il prompt del pulsante Prova la ricerca in linguaggio naturale, fai clic. Per impostazione predefinita, è selezionata la ricerca in linguaggio naturale.

  3. Nel campo Trova risorse tra i progetti con il linguaggio naturale, inserisci la query e poi fai clic su Invio.

  4. Per perfezionare la ricerca, fai clic su Filtri.

    • I filtri in più sezioni vengono valutati con l'operatore logico AND.
    • Più filtri all'interno di una singola sezione vengono valutati con l'operatore logico OR.

    Sono disponibili i seguenti filtri:

    • Ambito: esegui la ricerca nell'organizzazione (impostazione predefinita), nel progetto corrente o solo per le risorse preferite. Per ulteriori informazioni, vedi Ambito di ricerca.
    • Sistemi: il servizio Google Cloud a cui appartiene la risorsa, ad esempio BigQuery. Il sistema Knowledge Catalog contiene gruppi di voci.
    • Progetti: i progetti in cui eseguire la ricerca.
    • Tipo: il tipo di risorsa, ad esempio connessione BigQuery, bucket Cloud Storage o database. A seconda del tipo di risorsa, puoi anche filtrare per sottotipo, ad esempio il tipo di connessione o il dialetto SQL.
    • Seleziona località: le località in cui eseguire la ricerca.
    • Seleziona set di dati: i risultati della ricerca sono limitati alle risorse BigQuery appartenenti ai set di dati BigQuery selezionati. Nel campo Digita per filtrare, inserisci il nome del set di dati.
    • Tipi di aspetto: i tipi di aspetto di Knowledge Catalog associati alla risorsa che stai cercando. Per filtrare in base ai valori dell'aspetto, fai clic su Filtra in base ai valori del tipo di aspetto, quindi seleziona i valori.
  5. Per visualizzare ulteriori informazioni sulla risorsa cercata, fai clic sul nome della risorsa nei risultati di ricerca per aprire la pagina dei dettagli della voce.

Google Cloud CLI

Per cercare risorse, utilizza il comando gcloud dataplex entries search:

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

Sostituisci PROJECT_ID con l'ID del progetto Google Cloud .

C#

C#

Prima di provare questo esempio, segui le istruzioni di configurazione di C# nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog C#.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Vai

Go

Prima di provare questo esempio, segui le istruzioni di configurazione di Go nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Go.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.


//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

Java

Prima di provare questo esempio, segui le istruzioni di configurazione di Java nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Java.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Prima di provare questo esempio, segui le istruzioni di configurazione di Node.js nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Node.js.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

/**
 * 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

Prima di provare questo esempio, segui le istruzioni di configurazione di PHP nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog PHP.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Prima di provare questo esempio, segui le istruzioni di configurazione di Python nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Python.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

# 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

Prima di provare questo esempio, segui le istruzioni di configurazione di Ruby nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Ruby.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Per cercare risorse, utilizza il metodo searchEntries con il parametro SemanticSearch impostato su true.

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

Sostituisci quanto segue:

  • PROJECT_ID: l'ID del tuo Google Cloud progetto
  • LOCATION: la regione in cui esiste il progetto (ad esempio us-central1)

Visualizzare i dettagli di un asset restituito dalla ricerca

Console

Utilizza la ricerca di Knowledge Catalog per visualizzare i dettagli di un asset.

  1. Cerca un asset in Knowledge Catalog.

  2. Nei risultati di ricerca, fai clic sull'asset di cui vuoi visualizzare i dettagli.

    Viene visualizzata la pagina dei dettagli della voce. La pagina include le seguenti sezioni:

    • Dettagli della voce: includono informazioni quali tipo di voce, sistema, piattaforma, nome completo, ora di creazione, ora dell'ultima modifica, descrizione e responsabili.
    • Panoramica: una panoramica della voce, se disponibile.
    • Aspetti: gli aspetti obbligatori e facoltativi definiti per la voce. Per saperne di più, consulta Categorie di aspetti.

gcloud

Comando gcloud dataplex entries lookup:

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

Sostituisci quanto segue:

  • ENTRY_ID: l'ID della voce
  • ENTRY_GROUP_ID: l'ID del gruppo di voci
  • LOCATION: la regione in cui esiste il progetto
  • PROJECT_ID: l'ID del progetto Google Cloud

C#

C#

Prima di provare questo esempio, segui le istruzioni di configurazione di C# nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog C#.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Vai

Go

Prima di provare questo esempio, segui le istruzioni di configurazione di Go nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Go.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.


//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

Java

Prima di provare questo esempio, segui le istruzioni di configurazione di Java nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Java.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Prima di provare questo esempio, segui le istruzioni di configurazione di Node.js nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Node.js.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

/**
 * 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

Prima di provare questo esempio, segui le istruzioni di configurazione di PHP nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog PHP.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Prima di provare questo esempio, segui le istruzioni di configurazione di Python nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Python.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

# 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

Prima di provare questo esempio, segui le istruzioni di configurazione di Ruby nella guida rapida di Knowledge Catalog per l'utilizzo delle librerie client. Per saperne di più, consulta la documentazione di riferimento dell'API Knowledge Catalog Ruby.

Per eseguire l'autenticazione in Knowledge Catalog, configura le Credenziali predefinite dell'applicazione. Per saperne di più, consulta Configura l'autenticazione per un ambiente di sviluppo locale.

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

Per visualizzare i dettagli di una risorsa, utilizza il metodo lookupEntry.

Limitazioni

La ricerca presenta le seguenti limitazioni:

  • Le risorse pubbliche non rientrano nell'ambito della ricerca in linguaggio naturale.
  • Gli aspetti collegati ai link delle voci non rientrano nell'ambito della ricerca in linguaggio naturale.

Passaggi successivi