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 ProjectsTemplates 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 CreateJobFromTemplateRequest $postBody
43   * @param array $optParams Optional parameters.
44   * @return Job
45   */
46  public function create($projectId, CreateJobFromTemplateRequest $postBody, $optParams = [])
47  {
48    $params = ['projectId' => $projectId, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('create', [$params], Job::class);
51  }
52  /**
53   * Get the template associated with a template. (templates.get)
54   *
55   * @param string $projectId Required. The ID of the Cloud Platform project that
56   * the job belongs to.
57   * @param array $optParams Optional parameters.
58   *
59   * @opt_param string gcsPath Required. A Cloud Storage path to the template from
60   * which to create the job. Must be valid Cloud Storage URL, beginning with
61   * 'gs://'.
62   * @opt_param string location The [regional endpoint]
63   * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
64   * to direct the request.
65   * @opt_param string view The view to retrieve. Defaults to METADATA_ONLY.
66   * @return GetTemplateResponse
67   */
68  public function get($projectId, $optParams = [])
69  {
70    $params = ['projectId' => $projectId];
71    $params = array_merge($params, $optParams);
72    return $this->call('get', [$params], GetTemplateResponse::class);
73  }
74  /**
75   * Launch a template. (templates.launch)
76   *
77   * @param string $projectId Required. The ID of the Cloud Platform project that
78   * the job belongs to.
79   * @param LaunchTemplateParameters $postBody
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string dynamicTemplate.gcsPath Path to dynamic template spec file
83   * on Cloud Storage. The file must be a Json serialized DynamicTemplateFieSpec
84   * object.
85   * @opt_param string dynamicTemplate.stagingLocation Cloud Storage path for
86   * staging dependencies. Must be a valid Cloud Storage URL, beginning with
87   * `gs://`.
88   * @opt_param string gcsPath A Cloud Storage path to the template from which to
89   * create the job. Must be valid Cloud Storage URL, beginning with 'gs://'.
90   * @opt_param string location The [regional endpoint]
91   * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
92   * to direct the request.
93   * @opt_param bool validateOnly If true, the request is validated but not
94   * actually executed. Defaults to false.
95   * @return LaunchTemplateResponse
96   */
97  public function launch($projectId, LaunchTemplateParameters $postBody, $optParams = [])
98  {
99    $params = ['projectId' => $projectId, 'postBody' => $postBody];
100    $params = array_merge($params, $optParams);
101    return $this->call('launch', [$params], LaunchTemplateResponse::class);
102  }
103}
104
105// Adding a class alias for backwards compatibility with the previous class name.
106class_alias(ProjectsTemplates::class, 'Google_Service_Dataflow_Resource_ProjectsTemplates');
107