As far as I know, Shivam's solution is the correct one for launching a
template from Go. You're just routing your calls through a
Dataflow-specific API library rather than going through the API discovery
service.

On Wed, Feb 15, 2023 at 9:16 AM Kerry Donny-Clark <kerr...@google.com>
wrote:

> Jack added the Go templates capabilities, he should be able to help you
> out.
>
> On Wed, Feb 15, 2023, 12:37 AM Ashok KS <ashok7...@gmail.com> wrote:
>
>> Hi Shivam,
>>
>> Thanks a lot for your response. I did check the http request. But I
>> wanted to see if I can use the Google API client Library.
>> The docs show a Python example for it shown below. I wanted to know if
>> there is something similar with Go.
>>
>> from googleapiclient.discovery import build
>>
>> # project = 'your-gcp-project'
>> # job = 'unique-job-name'
>> # template = 'gs://dataflow-templates/latest/Word_Count'
>> # parameters = {
>> #     'inputFile': 'gs://dataflow-samples/shakespeare/kinglear.txt',
>> #     'output': 'gs://<your-gcs-bucket>/wordcount/outputs',
>> # }
>>
>> dataflow = build('dataflow', 'v1b3')
>> request = dataflow.projects().templates().launch(
>>     projectId=project,
>>     gcsPath=template,
>>     body={
>>         'jobName': job,
>>         'parameters': parameters,
>>     }
>> )
>>
>> response
>>
>>

Reply via email to