템플릿 가져오기(비동기)
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
템플릿에 대해 메타데이터 및 런타임 메타데이터를 가져오는 방법을 보여줍니다.
코드 샘플
C#
Dataflow에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Java
Dataflow에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Node.js
Dataflow에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Python
Dataflow에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 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 page provides code examples in C#, Java, Node.js, and Python that demonstrate how to retrieve metadata and runtime metadata about a Dataflow template.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples illustrate the use of the \u003ccode\u003egetTemplate\u003c/code\u003e method, showing how to construct and send a \u003ccode\u003eGetTemplateRequest\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach language example emphasizes setting up Application Default Credentials for authentication with Dataflow.\u003c/p\u003e\n"],["\u003cp\u003eThe examples require the user to input valid values for parameters such as project ID, location, and template GCS path, before running the code.\u003c/p\u003e\n"],["\u003cp\u003eThe various programming examples can be found on the Google Cloud sample browser.\u003c/p\u003e\n"]]],[],null,["# Get a template (async)\n\nDemonstrates how to get metadata and runtime metadata about a template.\n\nCode sample\n-----------\n\n### C#\n\n\nTo authenticate to Dataflow, 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 using https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.html;\n using System.Threading.Tasks;\n\n public sealed partial class GeneratedTemplatesServiceClientSnippets\n {\n /// \u003csummary\u003eSnippet for GetTemplateAsync\u003c/summary\u003e\n /// \u003cremarks\u003e\n /// This snippet has been automatically generated and should be regarded as a code template only.\n /// It will require modifications to work:\n /// - It may require correct/in-range values for request initialization.\n /// - It may require specifying regional endpoints when creating the service client as shown in\n /// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.\n /// \u003c/remarks\u003e\n public async Task GetTemplateRequestObjectAsync()\n {\n // Create client\n https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.TemplatesServiceClient.html templatesServiceClient = await https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.TemplatesServiceClient.html.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.TemplatesServiceClient.html#Google_Cloud_Dataflow_V1Beta3_TemplatesServiceClient_CreateAsync_System_Threading_CancellationToken_();\n // Initialize request argument(s)\n https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.html request = new https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.html\n {\n ProjectId = \"\",\n GcsPath = \"\",\n View = https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.html.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.Types.html.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.Types.TemplateView.html.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateRequest.Types.TemplateView.html#Google_Cloud_Dataflow_V1Beta3_GetTemplateRequest_Types_TemplateView_MetadataOnly,\n Location = \"\",\n };\n // Make the request\n https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.GetTemplateResponse.html response = await templatesServiceClient.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Dataflow.V1Beta3/latest/Google.Cloud.Dataflow.V1Beta3.TemplatesServiceClient.html#Google_Cloud_Dataflow_V1Beta3_TemplatesServiceClient_GetTemplateAsync_Google_Cloud_Dataflow_V1Beta3_GetTemplateRequest_Google_Api_Gax_Grpc_CallSettings_(request);\n }\n }\n\n### Java\n\n\nTo authenticate to Dataflow, 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.api.core.https://cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html;\n import com.google.dataflow.v1beta3.GetTemplateRequest;\n import com.google.dataflow.v1beta3.GetTemplateResponse;\n import com.google.dataflow.v1beta3.TemplatesServiceClient;\n\n public class AsyncGetTemplate {\n\n public static void main(String[] args) throws Exception {\n asyncGetTemplate();\n }\n\n public static void asyncGetTemplate() throws Exception {\n // This snippet has been automatically generated and should be regarded as a code template only.\n // It will require modifications to work:\n // - It may require correct/in-range values for request initialization.\n // - It may require specifying regional endpoints when creating the service client as shown in\n // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library\n try (TemplatesServiceClient templatesServiceClient = TemplatesServiceClient.https://cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.SettableApiFuture.html#com_google_api_core_SettableApiFuture__V_create__()) {\n GetTemplateRequest request =\n GetTemplateRequest.newBuilder()\n .setProjectId(\"projectId-894832108\")\n .setLocation(\"location1901043637\")\n .build();\n ApiFuture\u003cGetTemplateResponse\u003e future =\n templatesServiceClient.getTemplateCallable().futureCall(request);\n // Do something.\n GetTemplateResponse response = future.get();\n }\n }\n }\n\n### Node.js\n\n\nTo authenticate to Dataflow, 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 /**\n * This snippet has been automatically generated and should be regarded as a code template only.\n * It will require modifications to work.\n * It may require correct/in-range values for request initialization.\n * TODO(developer): Uncomment these variables before running the sample.\n */\n /**\n * Required. The ID of the Cloud Platform project that the job belongs to.\n */\n // const projectId = 'abc123'\n /**\n * Required. A Cloud Storage path to the template from which to\n * create the job.\n * Must be valid Cloud Storage URL, beginning with 'gs://'.\n */\n // const gcsPath = 'abc123'\n /**\n * The view to retrieve. Defaults to METADATA_ONLY.\n */\n // const view = {}\n /**\n * The regional endpoint \n * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to\n * which to direct the request.\n */\n // const location = 'abc123'\n\n // Imports the Dataflow library\n const {TemplatesServiceClient} = require('https://cloud.google.com/nodejs/docs/reference/dataflow/latest/overview.html').v1beta3;\n\n // Instantiates a client\n const dataflowClient = new https://cloud.google.com/nodejs/docs/reference/dataflow/latest/overview.html();\n\n async function callGetTemplate() {\n // Construct request\n const request = {\n };\n\n // Run request\n const response = await dataflowClient.getTemplate(request);\n console.log(response);\n }\n\n callGetTemplate();\n\n### Python\n\n\nTo authenticate to Dataflow, 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 # This snippet has been automatically generated and should be regarded as a\n # code template only.\n # It will require modifications to work:\n # - It may require correct/in-range values for request initialization.\n # - It may require specifying regional endpoints when creating the service\n # client as shown in:\n # https://googleapis.dev/python/google-api-core/latest/client_options.html\n from google.cloud import https://cloud.google.com/python/docs/reference/dataflow/latest/\n\n\n async def sample_get_template():\n # Create a client\n client = https://cloud.google.com/python/docs/reference/dataflow/latest/.https://cloud.google.com/python/docs/reference/dataflow/latest/google.cloud.dataflow_v1beta3.services.templates_service.TemplatesServiceAsyncClient.html()\n\n # Initialize request argument(s)\n request = https://cloud.google.com/python/docs/reference/dataflow/latest/.https://cloud.google.com/python/docs/reference/dataflow/latest/google.cloud.dataflow_v1beta3.types.GetTemplateRequest.html(\n gcs_path=\"gcs_path_value\",\n )\n\n # Make the request\n response = await client.https://cloud.google.com/python/docs/reference/dataflow/latest/google.cloud.dataflow_v1beta3.services.templates_service.TemplatesServiceAsyncClient.html#google_cloud_dataflow_v1beta3_services_templates_service_TemplatesServiceAsyncClient_get_template(request=request)\n\n # Handle the response\n print(response)\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=dataflow)."]]