관점 유형 나열
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content provides code samples in Java and Python for listing existing Aspect Types within Google Cloud Dataplex.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples demonstrate how to authenticate using Application Default Credentials and interact with the Dataplex API using client libraries.\u003c/p\u003e\n"],["\u003cp\u003eBoth Java and Python examples utilize the \u003ccode\u003eCatalogServiceClient\u003c/code\u003e to retrieve a list of Aspect Types, given a project ID and location.\u003c/p\u003e\n"],["\u003cp\u003eThe samples require setting up the project ID and location before execution and offer guidance on installation of client libraries.\u003c/p\u003e\n"],["\u003cp\u003eThe user is guided to find more code examples using the google cloud sample browser.\u003c/p\u003e\n"]]],[],null,["# List aspect types\n\nList existing aspect types.\n\nCode sample\n-----------\n\n### Java\n\n\nBefore trying this sample, follow the Java setup instructions in the\n[Dataplex Universal Catalog quickstart using\nclient libraries](/dataplex/docs/reference/libraries).\n\n\nFor more information, see the\n[Dataplex Universal Catalog Java API\nreference documentation](/java/docs/reference/google-cloud-dataplex/latest/overview).\n\n\nTo authenticate to Dataplex Universal Catalog, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n import com.google.cloud.dataplex.v1.https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.AspectType.html;\n import com.google.cloud.dataplex.v1.https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.CatalogServiceClient.html;\n import com.google.cloud.dataplex.v1.https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.LocationName.html;\n import com.google.common.collect.ImmutableList;\n import java.io.IOException;\n import java.util.List;\n\n public class ListAspectTypes {\n\n public static void main(String[] args) throws IOException {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"MY_PROJECT_ID\";\n // Available locations: https://cloud.google.com/dataplex/docs/locations\n String location = \"MY_LOCATION\";\n\n List\u003cAspectType\u003e aspectTypes = listAspectTypes(projectId, location);\n aspectTypes.forEach(\n aspectType -\u003e System.out.println(\"Aspect type name: \" + aspectType.getName()));\n }\n\n // Method to list Aspect Types located in projectId and location\n public static List\u003cAspectType\u003e listAspectTypes(String projectId, String location)\n throws IOException {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests.\n try (https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.CatalogServiceClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.CatalogServiceClient.html.create()) {\n https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.LocationName.html locationName = https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.LocationName.html.of(projectId, location);\n https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.CatalogServiceClient.html.https://cloud.google.com/java/docs/reference/google-cloud-dataplex/latest/com.google.cloud.dataplex.v1.CatalogServiceClient.ListAspectTypesPagedResponse.html listAspectTypesResponse =\n client.listAspectTypes(locationName);\n // Paging is implicitly handled by .iterateAll(), all results will be returned\n return ImmutableList.copyOf(listAspectTypesResponse.iterateAll());\n }\n }\n }\n\n### Python\n\n\nBefore trying this sample, follow the Python setup instructions in the\n[Dataplex Universal Catalog quickstart using\nclient libraries](/dataplex/docs/reference/libraries).\n\n\nFor more information, see the\n[Dataplex Universal Catalog Python API\nreference documentation](/python/docs/reference/dataplex/latest).\n\n\nTo authenticate to Dataplex Universal Catalog, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n from typing import List\n\n from google.cloud import https://cloud.google.com/python/docs/reference/dataplex/latest/\n\n\n def list_aspect_types(project_id: str, location: str) -\u003e List[dataplex_v1.AspectType]:\n \"\"\"Method to list Aspect Types located in project_id and location\"\"\"\n\n # Initialize client that will be used to send requests across threads. This\n # client only needs to be created once, and can be reused for multiple requests.\n # After completing all of your requests, call the \"__exit__()\" method to safely\n # clean up any remaining background resources. Alternatively, use the client as\n # a context manager.\n with https://cloud.google.com/python/docs/reference/dataplex/latest/.https://cloud.google.com/python/docs/reference/dataplex/latest/google.cloud.dataplex_v1.services.catalog_service.CatalogServiceClient.html() as client:\n # The resource name of the Aspect Type location\n parent = f\"projects/{project_id}/locations/{location}\"\n results = client.list_aspect_types(parent=parent)\n return list(results)\n\n\n if __name__ == \"__main__\":\n # TODO(developer): Replace these variables before running the sample.\n project_id = \"MY_PROJECT_ID\"\n # Available locations: https://cloud.google.com/dataplex/docs/locations\n location = \"MY_LOCATION\"\n\n aspect_types = list_aspect_types(project_id, location)\n for aspect_type in aspect_types:\n print(f\"Aspect type name: {aspect_type.name}\")\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=dataplex)."]]