1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Dataflow\Resource;
19
20use Google\Service\Dataflow\CreateJobFromTemplateRequest;
21use Google\Service\Dataflow\GetTemplateResponse;
22use Google\Service\Dataflow\Job;
23use Google\Service\Dataflow\LaunchTemplateParameters;
24use Google\Service\Dataflow\LaunchTemplateResponse;
25
26/**
27 * The "templates" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $dataflowService = new Google\Service\Dataflow(...);
31 *   $templates = $dataflowService->templates;
32 *  </code>
33 */
34class ProjectsLocationsTemplates extends \Google\Service\Resource
35{
36  /**
37   * Creates a Cloud Dataflow job from a template. Do not enter confidential
38   * information when you supply string values using the API. (templates.create)
39   *
40   * @param string $projectId Required. The ID of the Cloud Platform project that
41   * the job belongs to.
42   * @param string $location The [regional endpoint]
43   * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
44   * to direct the request.
45   * @param CreateJobFromTemplateRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return Job
48   */
49  public function create($projectId, $location, CreateJobFromTemplateRequest $postBody, $optParams = [])
50  {
51    $params = ['projectId' => $projectId, 'location' => $location, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Job::class);
54  }
55  /**
56   * Get the template associated with a template. (templates.get)
57   *
58   * @param string $projectId Required. The ID of the Cloud Platform project that
59   * the job belongs to.
60   * @param string $location The [regional endpoint]
61   * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
62   * to direct the request.
63   * @param array $optParams Optional parameters.
64   *
65   * @opt_param string gcsPath Required. A Cloud Storage path to the template from
66   * which to create the job. Must be valid Cloud Storage URL, beginning with
67   * 'gs://'.
68   * @opt_param string view The view to retrieve. Defaults to METADATA_ONLY.
69   * @return GetTemplateResponse
70   */
71  public function get($projectId, $location, $optParams = [])
72  {
73    $params = ['projectId' => $projectId, 'location' => $location];
74    $params = array_merge($params, $optParams);
75    return $this->call('get', [$params], GetTemplateResponse::class);
76  }
77  /**
78   * Launch a template. (templates.launch)
79   *
80   * @param string $projectId Required. The ID of the Cloud Platform project that
81   * the job belongs to.
82   * @param string $location The [regional endpoint]
83   * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
84   * to direct the request.
85   * @param LaunchTemplateParameters $postBody
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param string dynamicTemplate.gcsPath Path to dynamic template spec file
89   * on Cloud Storage. The file must be a Json serialized DynamicTemplateFieSpec
90   * object.
91   * @opt_param string dynamicTemplate.stagingLocation Cloud Storage path for
92   * staging dependencies. Must be a valid Cloud Storage URL, beginning with
93   * `gs://`.
94   * @opt_param string gcsPath A Cloud Storage path to the template from which to
95   * create the job. Must be valid Cloud Storage URL, beginning with 'gs://'.
96   * @opt_param bool validateOnly If true, the request is validated but not
97   * actually executed. Defaults to false.
98   * @return LaunchTemplateResponse
99   */
100  public function launch($projectId, $location, LaunchTemplateParameters $postBody, $optParams = [])
101  {
102    $params = ['projectId' => $projectId, 'location' => $location, 'postBody' => $postBody];
103    $params = array_merge($params, $optParams);
104    return $this->call('launch', [$params], LaunchTemplateResponse::class);
105  }
106}
107
108// Adding a class alias for backwards compatibility with the previous class name.
109class_alias(ProjectsLocationsTemplates::class, 'Google_Service_Dataflow_Resource_ProjectsLocationsTemplates');
110