Kishan Kumar
Kishan Kumar

Reputation: 141

Passing Parameters to template While Launching using Dataflow API

I have to Pass Parameters to Template While launching Using Dataflow API's in App Engine Dataflow Job.

 com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = 


    dataflowService.projects().locations().templates().launch(projectId,"us-central1",null);

                request1.setGcsPath(template);
                request1.setLocation("us-central1");
                request1.setValidateOnly(false);

                //Storing launch Response
                LaunchTemplateResponse response1 = request1.execute();

In My Code, I am Able to Set GCS path, Location, and Validity but not able to set Parameters Like in Cloud Function. is Thier any method to Set Parameters Using java. Because in Python its Possible So I thought So in Java.

Upvotes: 1

Views: 1305

Answers (1)

Kishan Kumar
Kishan Kumar

Reputation: 141

To Pass A parameter I Used -: LaunchTemplateParameters parameters = new LaunchTemplateParameters();

LaunchTemplateParameters parameters = new LaunchTemplateParameters();
    Map<String,String> map = new HashMap<String,String>();
            map.put("inputFile", "gs://xyz-bucket/Temp.txt");
parameters.setParameters(map);
        com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = 
                        dataflowService.projects().locations().templates().launch(projectId,"us-central1",parameters);

            request1.setGcsPath(template);
            request1.setLocation("us-central1");
            request1.setValidateOnly(false);


            LaunchTemplateResponse response1 = request1.execute();

Upvotes: 1

Related Questions