[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Dataflow\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Dataflow\CreateJobFromTemplateRequest;
|
---|
| 21 | use Google\Service\Dataflow\GetTemplateResponse;
|
---|
| 22 | use Google\Service\Dataflow\Job;
|
---|
| 23 | use Google\Service\Dataflow\LaunchTemplateParameters;
|
---|
| 24 | use 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->projects_locations_templates;
|
---|
| 32 | * </code>
|
---|
| 33 | */
|
---|
| 34 | class 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. To create a job, we
|
---|
| 39 | * recommend using `projects.locations.templates.create` with a [regional
|
---|
| 40 | * endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-
|
---|
| 41 | * endpoints). Using `projects.templates.create` is not recommended, because
|
---|
| 42 | * your job will always start in `us-central1`. (templates.create)
|
---|
| 43 | *
|
---|
| 44 | * @param string $projectId Required. The ID of the Cloud Platform project that
|
---|
| 45 | * the job belongs to.
|
---|
| 46 | * @param string $location The [regional endpoint]
|
---|
| 47 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
|
---|
| 48 | * to direct the request.
|
---|
| 49 | * @param CreateJobFromTemplateRequest $postBody
|
---|
| 50 | * @param array $optParams Optional parameters.
|
---|
| 51 | * @return Job
|
---|
| 52 | * @throws \Google\Service\Exception
|
---|
| 53 | */
|
---|
| 54 | public function create($projectId, $location, CreateJobFromTemplateRequest $postBody, $optParams = [])
|
---|
| 55 | {
|
---|
| 56 | $params = ['projectId' => $projectId, 'location' => $location, 'postBody' => $postBody];
|
---|
| 57 | $params = array_merge($params, $optParams);
|
---|
| 58 | return $this->call('create', [$params], Job::class);
|
---|
| 59 | }
|
---|
| 60 | /**
|
---|
| 61 | * Get the template associated with a template. To get the template, we
|
---|
| 62 | * recommend using `projects.locations.templates.get` with a [regional endpoint]
|
---|
| 63 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
|
---|
| 64 | * `projects.templates.get` is not recommended, because only templates that are
|
---|
| 65 | * running in `us-central1` are retrieved. (templates.get)
|
---|
| 66 | *
|
---|
| 67 | * @param string $projectId Required. The ID of the Cloud Platform project that
|
---|
| 68 | * the job belongs to.
|
---|
| 69 | * @param string $location The [regional endpoint]
|
---|
| 70 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
|
---|
| 71 | * to direct the request.
|
---|
| 72 | * @param array $optParams Optional parameters.
|
---|
| 73 | *
|
---|
| 74 | * @opt_param string gcsPath Required. A Cloud Storage path to the template from
|
---|
| 75 | * which to create the job. Must be valid Cloud Storage URL, beginning with
|
---|
| 76 | * 'gs://'.
|
---|
| 77 | * @opt_param string view The view to retrieve. Defaults to METADATA_ONLY.
|
---|
| 78 | * @return GetTemplateResponse
|
---|
| 79 | * @throws \Google\Service\Exception
|
---|
| 80 | */
|
---|
| 81 | public function get($projectId, $location, $optParams = [])
|
---|
| 82 | {
|
---|
| 83 | $params = ['projectId' => $projectId, 'location' => $location];
|
---|
| 84 | $params = array_merge($params, $optParams);
|
---|
| 85 | return $this->call('get', [$params], GetTemplateResponse::class);
|
---|
| 86 | }
|
---|
| 87 | /**
|
---|
| 88 | * Launches a template. To launch a template, we recommend using
|
---|
| 89 | * `projects.locations.templates.launch` with a [regional endpoint]
|
---|
| 90 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
|
---|
| 91 | * `projects.templates.launch` is not recommended, because jobs launched from
|
---|
| 92 | * the template will always start in `us-central1`. (templates.launch)
|
---|
| 93 | *
|
---|
| 94 | * @param string $projectId Required. The ID of the Cloud Platform project that
|
---|
| 95 | * the job belongs to.
|
---|
| 96 | * @param string $location The [regional endpoint]
|
---|
| 97 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which
|
---|
| 98 | * to direct the request.
|
---|
| 99 | * @param LaunchTemplateParameters $postBody
|
---|
| 100 | * @param array $optParams Optional parameters.
|
---|
| 101 | *
|
---|
| 102 | * @opt_param string dynamicTemplate.gcsPath Path to the dynamic template
|
---|
| 103 | * specification file on Cloud Storage. The file must be a JSON serialized
|
---|
| 104 | * `DynamicTemplateFileSpec` object.
|
---|
| 105 | * @opt_param string dynamicTemplate.stagingLocation Cloud Storage path for
|
---|
| 106 | * staging dependencies. Must be a valid Cloud Storage URL, beginning with
|
---|
| 107 | * `gs://`.
|
---|
| 108 | * @opt_param string gcsPath A Cloud Storage path to the template to use to
|
---|
| 109 | * create the job. Must be valid Cloud Storage URL, beginning with `gs://`.
|
---|
| 110 | * @opt_param bool validateOnly If true, the request is validated but not
|
---|
| 111 | * actually executed. Defaults to false.
|
---|
| 112 | * @return LaunchTemplateResponse
|
---|
| 113 | * @throws \Google\Service\Exception
|
---|
| 114 | */
|
---|
| 115 | public function launch($projectId, $location, LaunchTemplateParameters $postBody, $optParams = [])
|
---|
| 116 | {
|
---|
| 117 | $params = ['projectId' => $projectId, 'location' => $location, 'postBody' => $postBody];
|
---|
| 118 | $params = array_merge($params, $optParams);
|
---|
| 119 | return $this->call('launch', [$params], LaunchTemplateResponse::class);
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 124 | class_alias(ProjectsLocationsTemplates::class, 'Google_Service_Dataflow_Resource_ProjectsLocationsTemplates');
|
---|